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 4058 - Make iOS build friendlier for consumption by Xamarin projects
Summary: Make iOS build friendlier for consumption by Xamarin projects
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: don't know
Hardware: iPhone/iPod touch iOS 11
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-20 20:04 UTC by Cole Campbell
Modified: 2018-01-20 20:04 UTC (History)
0 users

See Also:


Attachments
A patch including the changes described in this ticket. (7.51 KB, text/plain)
2018-01-20 20:04 UTC, Cole Campbell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cole Campbell 2018-01-20 20:04:46 UTC
Created attachment 3148 [details]
A patch including the changes described in this ticket.

The included patch makes the following changes, which are designed to make it easier to use SDL from a Xamarin iOS project:

1. When the XAMARIN flag is defined as part of the build arguments, the main() function defined in SDL_uikitappdelegate.m is removed. The Xamarin runtime already defines a main() function, so this being present causes linker errors.

2. When the SDL_DYNAMIC_MAIN flag is defined, the following new API functions are exposed:

 * SDL_SetDynamicMain()
 * SDL_GetDynamicMain()

A C# application can use P/Invoke to pass a pointer to managed code into the SDL_SetDynamicMain() function; a simple replacement for the SDL_main function is included which will invoke this function at the necessary time.

The SDL_DYNAMIC_MAIN flag is automatically set when the XAMARIN flag is set and the target platform is iOS.