[Mono-devel-list] mono SDL linux/win32 SDL.DLL - my brain hurts!

ted leslie tleslie at tcn.net
Wed Jul 20 22:49:56 EDT 2005


(After my preamble, I am essentially asking .. how does a wrapper to .Net/Mono work .....)

There must not be to many people writting cross platform apps
that need sound? Searching for sound (audio, mp3, sound) on mono-project.com via mail list, etc
returns almost nothing.

Anyways I came across SDL on the Resources page!!!! wow!!! this will solve my problems!

I go to   cs-sdl.sourceforge.net
and check it out, 
It has SDL.NET for Win32 and Linux (mono is supported, it says)
So i download the support libraries for SDL.NET which are the traditional SDL libs .. put them on Win32 and updated
my ones on my Suse box.
I ran the Examples just fine on Win32

Now on to Linux and Mono ...............

First off the latest SDL.NET downloads on sourceforge seem to be for Win32 only (as an aside they have a nice 
installer that does everything for you on the Win32 side of things)

So i dig back a COUPLE years and get a gz file (of SDL.NET) that has linux support
	(incidently i see screen caps in SDL.NET project page of SDL apps running on linux so even thought
		the linux support in the project seems old, it infact looks like it run and works)

I build the SDL.NET on Linux (using latest stable release Mono), but there is an error in the Makefile,
the pathing slash is of the windows variety (hmmmmm...?), so i fix that and Makefile the SDL.NET DLL's
and the examples.

The Examples compile/build fine but the give a Mono runtime error that they can't
find System DLL:SDL.dll

> --An exception was thrown by the type initializer for SdlDotNet.Music ---> System.DllNotFoundException: SDL.dll

So this is were I hit a dead end because I don't know anything about .Net/C# wrappers to 
traditional C based libraries on Linux.
I looked at the gtk-sharp wrapper (cause i know it works), I see a mixer of C and CS files and traditional
gcc references in makefiles, but basically it looks like a big job to figure out gtk-sharp's process of a wrapper.

On that note, is there a doucmentation section somewhere on that - i.e. building wrappers?

To me, I am thinking in the end SDL.NET has to get hold of the routines in the
SDL ".so" file right? 
how does that happen? I know how it happens in a traditional C/gcc compile, link, create a .so file, and compile your apps with dynamic support againt the ".so" ....  what bit of magic get Mono to see/do that (with its wrapper)?

I check around the SDL.NET code and see in the Natives.cs file this:

                const string SDL_DLL = "SDL";
                const string MIX_DLL = "SDL_mixer";
                // General
                [DllImport(SDL_DLL, CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
                public static extern int SDL_Init(int flags);

which I am thinking is pretty key to the process ...
but why reference   SDL.DLL  ... I don't have that on Linux, thats on Win32.

Anyone shed light?

Also, would it be a hard job making the same wrapper to the SDL lib on MAC-OSX to complete a good cross-platfrom
SDL.NET class for Mono ? 

-tl
 





More information about the Mono-devel-list mailing list