Using SDL with CLR?

Hi, I tried posting this question on the SDL forum (
http://forums.libsdl.org/viewforum.php?f=1) but was told by the system that
only user with special rights are allowed to post there.

So, my question if if it’s possible to use SDL in a CLR windows forms app.
Or more generally, if it’s possible to use SDL without a main-function. My
main function in the CLR-app looks like this:

int main(array<System::String ^> ^args)

and this doesn’t match the SDL-main-replace macro. I’m developing a managed
windows forms app where I want to use certain SDL-features in a couple of
unmanaged classes. Mainly I want to use SDL_Image-functions, SDL_config and
SDL_net. The app will to networking and image proccessing on the unmanaged
side and use managed winforms to display a GUI.

Many thanks,
Lars Englund

You could modify SDL…
Unmodified, you’d need to do some refactoring. SDL starts the
execution at the int main(int argc, char* argv) located in a .cpp file
that includes SDL.
Using unmodified SDL though can be trickier. You’ll have to do some refactoring.
There is no problem getting the win32 stuff with vanilla SDL though.
If you do a little refactoring to have SDL creating the stuff and then
your existing systems just using it, there’s no problem with using
SDL.On Fri, Feb 15, 2013 at 5:17 PM, Lars Englund <lars.englund at gmail.com> wrote:

Hi, I tried posting this question on the SDL forum (http://forums.libsdl.org/viewforum.php?f=1)?but was told by the system that only user with special rights are allowed to post there.

So, my question if if it’s possible to use SDL in a CLR windows forms app. Or more generally, if it’s possible to use SDL without a main-function. My main function in the CLR-app looks like this:

int main(array<System::String ^> ^args)

and this doesn’t match the SDL-main-replace macro. I’m developing a managed windows forms app where I want to use certain SDL-features in a couple of unmanaged classes. Mainly I want to use SDL_Image-functions, SDL_config and SDL_net. The app will to networking and image proccessing on the unmanaged side and use managed winforms to display a GUI.

Many thanks,
Lars Englund


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

You could try not including the SDL_main library, then doing this
after including the SDL header:

#undef main

2013/2/16, Ivan Rubinson :> You could modify SDL…

Unmodified, you’d need to do some refactoring. SDL starts the
execution at the int main(int argc, char* argv) located in a .cpp file
that includes SDL.
Using unmodified SDL though can be trickier. You’ll have to do some
refactoring.
There is no problem getting the win32 stuff with vanilla SDL though.
If you do a little refactoring to have SDL creating the stuff and then
your existing systems just using it, there’s no problem with using
SDL.

On Fri, Feb 15, 2013 at 5:17 PM, Lars Englund <lars.englund at gmail.com> wrote:

Hi, I tried posting this question on the SDL forum
(http://forums.libsdl.org/viewforum.php?f=1)?but was told by the system
that only user with special rights are allowed to post there.

So, my question if if it’s possible to use SDL in a CLR windows forms app.
Or more generally, if it’s possible to use SDL without a main-function. My
main function in the CLR-app looks like this:

int main(array<System::String ^> ^args)

and this doesn’t match the SDL-main-replace macro. I’m developing a
managed windows forms app where I want to use certain SDL-features in a
couple of unmanaged classes. Mainly I want to use SDL_Image-functions,
SDL_config and SDL_net. The app will to networking and image proccessing
on the unmanaged side and use managed winforms to display a GUI.

Many thanks,
Lars Englund


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org