We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1045

Summary: Wanted: ability to not include main() in libSDLiPhone.a
Product: SDL Reporter: Jack Jansen <Jack.Jansen>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: vitto.giova
Version: HG 2.0   
Hardware: iPhone/iPod touch   
OS: iOS (All)   

Description Jack Jansen 2010-08-17 06:41:05 UTC
We're using SDL only for audio on the iPhone, and the main() program in SDL_uikitappdelegate.m is conflicting with our own main program. But: some other routines from that file are needed, obviously.

I tried disabling the main program by adding GCC_PREPROCESSOR_DEFINES=main=mainUNUSED to the xcodebuild command line for building libSDLiPhone.a, but unfortunately that doesn't work because the file starts with
#ifdef main
#undef main
#endif

Could I request that you add something like #ifndef WITHOUT_SDL_MAIN_PROGRAM or something like that around the main() program, or some other means whereby we can exclude the main program while keeping all the other goodies?

Thanks,
     Jack
Comment 1 Vittorio Giovara 2011-04-27 18:15:53 UTC
hey, does this http://hg.libsdl.org/SDL/rev/8a04b596b472 help you?
Comment 2 Sam Lantinga 2013-05-21 01:22:06 UTC
It looks like you can disable the video driver (and main()) by turning off SDL_VIDEO_DRIVER_UIKIT in SDL_config_iphoneos.h

I haven't tried it, so please let me know if there are any problems with this.