Posts

Post not yet marked as solved
3 Replies
2.4k Views
I have a cross-platform C++ API I want to run on Linux, Windows, and Mac. On Mac, it uses a main() function in Objective-C to initialize some stuff, and then calls the C++ main() function, which on Mac is renamed to main_() as follows:#ifdef __APPLE__ int main_(int argc,const char *argv[]) #else int main(int argc,const char *argv[]) #endif {This is pretty ugly and I'd like to do away with it. Is there any way to set the entry point to an Objective-C function that isn't named main(), or somehow make it so all our code examples don't have to have an ugly hack like this for Mac?I tried adding the link flag -emymain or -e_mymain and renaming my Objective-C main() function to mymain() but the linker says the function is not found for the architecture x86_64.
Posted
by JoshKlint.
Last updated
.