Page 1 of 1

Inquire, to make my library support MacOS

Posted: Sat Feb 01, 2020 11:21 am
by lionking
I have a cross-platform C++ library that I have created which supports (Windows, Linux), but I want to support macOS too, and in order to use macOS "cocoa" I must use either Objective-C or Objective-C++.
I have read a few about that subject and I found that to compile a mixed code of macOS "Cocoa" Objective-C++ and C++ you must change the C++ source file extension from ".cpp" to ".mm", so, If I do that then my library will be two versions one for Window, Linux that has ".cpp" extension and the other one for macOS that has ".mm" extension.


Hint: my library consists of 2 files ".h" for class declaration and ".cpp" for class definition.

Is that the right and only way to make a library/application to support macOS?

Re: Inquire, to make my library support MacOS

Posted: Sat Feb 01, 2020 7:07 pm
by New Pagodi
The development tools supplied by apple use the clang compiler. It is capable of compiling c,c++, objective c, and maybe others as well. You only need to use objective c if you want to work directly with the system libraries.

As far as gui programming does, on macOS, wxWidgets is basically a c++ wrapper around the objective c libraries.

As far as libraries go, you can still build and use a traditional library file, but usually on macOS you would build a framework. A framework basically bundles up the lib, headers, and other resource files.

Re: Inquire, to make my library support MacOS

Posted: Fri Feb 07, 2020 10:14 pm
by ONEEYEMAN
Hi,
Why do you want to interfere with the Objective-C code?
If you need a way to test you code on OSX, I can help you with that. I own 2 Mac laptops - one with 10.8 and one with 10.13.

In general all you need to do is just like on Windows/Linux - compile wxWidgets and then compile your code against it.
Then tgry it and fix the bugs that is there on OSX.

Thank you.

P.S.: You can PM me with the code for the test purposes.

Re: Inquire, to make my library support MacOS

Posted: Mon Feb 10, 2020 2:54 pm
by lionking
Why do you want to interfere with the Objective-C code?
I just want to use some features of "Cocoa" in my library because there's no alternative way to do that except using "cocoa".
If you need a way to test you code on OSX, I can help you with that. I own 2 Mac laptops - one with 10.8 and one with 10.13.
Thank you, I have a virtual machine that I use to test my code on macOS.

P.S.: You can PM me with the code for the test purposes.
I thank you again.

Re: Inquire, to make my library support MacOS

Posted: Mon Feb 10, 2020 3:42 pm
by ONEEYEMAN
Hi,
My understanding is that you are violating the Apple license.
AFAIK, OSX can't be installed in VM...

But maybe I'm wrong?

Thank you.