Re: Platform independent code?
John Smith wrote:
I have a visual studio c++ project which is a dynamic dll.
It's made for windows, and has windows.h and other windows specific
headers.
I want to compile the same project for linux and for mac os.
Do you have any suggestions how to do that?
You have to check what kind of interaction the code does with the
Windows API. Remove the include and check the error list.
If it is only for basic services like file system or semaphores it
should be mainly straight forward to do the porting to standard C++ or
Posix compatible code.
But if it is a native C++ GUI application, I would not recommend to
think about porting at all. Write the application anew. Believe me, it
is less work.
Of course, you may copy some of the code that contains the programs
internal logic. But if that code relies on further MS-libraries like MFC
or ATL even this will fail.
Option B: leave the application as it is and start it with wine.
But since you are talking about a shared library I have no idea how you
want to integrate it into a non-windows application. Platform
independent interfaces of shared libraries are extremely rare beyond the
world of platform independent applications like Mozilla or similar.
I read about some library's like wxwidgets, boost, qt and similar.
Do I have to use one of them?
If you want to rewrite the application I would recommend this.
Marcel