Page 1 of 1 [ 11 posts ] 

Madbones
Veteran
Veteran

User avatar

Joined: 7 Mar 2010
Age: 27
Gender: Male
Posts: 777
Location: In the zone

23 Aug 2011, 6:17 pm

There is this project that is only for Windows and its made in C++ and its open source.
I want to port it to OSX.
How would I go about doing this?
Sorry, if this is an ignorent question.



Cornflake
Administrator
Administrator

User avatar

Joined: 30 Oct 2010
Gender: Male
Posts: 69,064
Location: Over there

23 Aug 2011, 7:58 pm

That really depends on exactly what "only for Windows" means.

Each call made to the Windows API will require substitutions to be made for the OSX equivalents, and those with no direct equivalent will require stub code or wrappers to simulate them in OSX. If it's also using something like DirectX or other Windows-specific libraries then you have an even bigger problem.
Other than that, and provided no fancy compiler-specific tricks are being pulled with the code generally, the rest should just compile as-is since C++ on one platform 'should' be the same as C++ on a different one.

[Edited for clarity and typo]


_________________
Giraffe: a ruminant with a view.


Last edited by Cornflake on 24 Aug 2011, 7:04 am, edited 1 time in total.

Ancalagon
Veteran
Veteran

User avatar

Joined: 25 Dec 2007
Age: 45
Gender: Male
Posts: 2,302

23 Aug 2011, 10:22 pm

There is a part of the wine project called winelib that might help with the porting if you can run the app under wine on a mac.


_________________
"A dead thing can go with the stream, but only a living thing can go against it." --G. K. Chesterton


Cornflake
Administrator
Administrator

User avatar

Joined: 30 Oct 2010
Gender: Male
Posts: 69,064
Location: Over there

24 Aug 2011, 6:59 am

^^ That's executing a binary compiled for one OS on a different one.
Porting is recompiling the source on another OS and generating a native binary for that OS.


_________________
Giraffe: a ruminant with a view.


Ancalagon
Veteran
Veteran

User avatar

Joined: 25 Dec 2007
Age: 45
Gender: Male
Posts: 2,302

24 Aug 2011, 8:39 am

From the Winelib User's Guide:

Quote:
Winelib is a development toolkit which allows you to compile your Windows applications on Unix.

Most of Winelib's code consists of the Win32 API implementation. Fortunately this part is 100 percent shared with Wine. The remainder consists of Windows compatible headers and tools like the resource compiler (and even these are used when compiling Wine).

So it actually does involve compiling for the native OS. Basically, wine has lots of the windows API implemented for unix already, so lots of the 'stub code and wrappers' you mentioned would be already written.

Of course, wine isn't perfect, as it has unimplemented functions and bugs, but it would probably save a lot of time and effort for porting non-platform-independent windows code.


_________________
"A dead thing can go with the stream, but only a living thing can go against it." --G. K. Chesterton


Tom_Kakes
Deinonychus
Deinonychus

User avatar

Joined: 15 Jul 2011
Gender: Male
Posts: 342

24 Aug 2011, 9:15 am

Madbones wrote:
There is this project that is only for Windows and its made in C++ and its open source.
I want to port it to OSX.
How would I go about doing this?
Sorry, if this is an ignorent question.


Can I ask what the project is?



Madbones
Veteran
Veteran

User avatar

Joined: 7 Mar 2010
Age: 27
Gender: Male
Posts: 777
Location: In the zone

24 Aug 2011, 10:09 am

Tom_Kakes wrote:
Madbones wrote:
There is this project that is only for Windows and its made in C++ and its open source.
I want to port it to OSX.
How would I go about doing this?
Sorry, if this is an ignorent question.


Can I ask what the project is?


Notepad++



Tom_Kakes
Deinonychus
Deinonychus

User avatar

Joined: 15 Jul 2011
Gender: Male
Posts: 342

24 Aug 2011, 10:21 am

Madbones wrote:
Tom_Kakes wrote:
Madbones wrote:
There is this project that is only for Windows and its made in C++ and its open source.
I want to port it to OSX.
How would I go about doing this?
Sorry, if this is an ignorent question.


Can I ask what the project is?


Notepad++


Ok... Why?

That would be like using a hammer to paint a wall. What functionality do you miss when using Linux? Chances are it has already been implemented in a Linux editor in some way.



Ancalagon
Veteran
Veteran

User avatar

Joined: 25 Dec 2007
Age: 45
Gender: Male
Posts: 2,302

24 Aug 2011, 10:48 am

From a quick google search, it appears that Notepad++ runs under wine. If you just want to get it to run on your machine, installing wine would probably make it just work, and if you still want to port it, it might just be a matter of recompiling with winelib.


_________________
"A dead thing can go with the stream, but only a living thing can go against it." --G. K. Chesterton


Cornflake
Administrator
Administrator

User avatar

Joined: 30 Oct 2010
Gender: Male
Posts: 69,064
Location: Over there

24 Aug 2011, 11:25 am

Ancalagon wrote:
So it actually does involve compiling for the native OS.
Oh, Ok - fair enough.
I was thinking somewhat smaller than that but it involved a bit of re-inventing the wheel... :oops:

Quote:
Of course, wine isn't perfect, as it has unimplemented functions and bugs, but it would probably save a lot of time and effort for porting non-platform-independent windows code.
Yep, I've used Wine.
But since the application is Notepad++ I'd expect a relatively minimal dependence on Windows support (basic I/O, file, mouse and window handling) so that should help make it a bit more do-able and as you've said, it already runs under Wine.

@Madbones: Why not just give this a try instead? It might save many headaches for little return. http://www.jedit.org/index.php


_________________
Giraffe: a ruminant with a view.


Madbones
Veteran
Veteran

User avatar

Joined: 7 Mar 2010
Age: 27
Gender: Male
Posts: 777
Location: In the zone

24 Aug 2011, 12:51 pm

Cornflake wrote:
Ancalagon wrote:
So it actually does involve compiling for the native OS.
Oh, Ok - fair enough.
I was thinking somewhat smaller than that but it involved a bit of re-inventing the wheel... :oops:

Quote:
Of course, wine isn't perfect, as it has unimplemented functions and bugs, but it would probably save a lot of time and effort for porting non-platform-independent windows code.
Yep, I've used Wine.
But since the application is Notepad++ I'd expect a relatively minimal dependence on Windows support (basic I/O, file, mouse and window handling) so that should help make it a bit more do-able and as you've said, it already runs under Wine.

@Madbones: Why not just give this a try instead? It might save many headaches for little return. http://www.jedit.org/index.php

Aha!
Thanks.
Just used it looks awesome.
Thanks again.