Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » WinAPI UNICODE question
Re: WinAPI UNICODE question [message #19500 is a reply to message #19466] |
Tue, 09 December 2008 09:41   |
cbpporter
Messages: 1427 Registered: September 2007
|
Ultimate Contributor |
|
|
I am going to give now a concrete example with attached modified files. I've chosen Color.h and Color.cpp to illustrate some points because they are so easy and universally used throughout my modified files.
What I done here is added inline copies of the function GetRValue to RGB with different names and used them. GetRValue and friends are declared as macros in windows.h and and as inline functions under POSIX so it would seem that we are covered in regards to cross-platform compatibility. Unfortunately, this is not the case.
The biggest problem is that you can not write code without having using namespace Upp somewhere before. If I try to use Upp::GetRValue, it will compile and work fine under Linux, but not under Windows. I havent't encountered this problem with exactlly this function, but I did with other functions which I'm going to touch in later posts (I'm looking at GetTickCount especially).
Another problem is that under Linux, you can get the adress of such functions,while under Windows the same code will not compile again.
This is why I'va chosen to introduce new names. If you don't like the solution, GetRValue and friends could be undefed and defined as macros under all platforms and in Upp namespace, not just under POSIX. But this could lead to name clashes if someone later includes windows.h again.
-
Attachment: Core.zip
(Size: 2.45KB, Downloaded 434 times)
|
|
|
Goto Forum:
Current Time: Mon Jul 14 08:14:48 CEST 2025
Total time taken to generate the page: 0.04772 seconds
|