Re: [q-lang-users] SDL anyone?
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2007-01-03 07:43:24
|
Andrew Berg wrote: > So, it turns out that having my kids around for the last week pretty > much stopped me from having any time to hack, so today I'm back at > it. :^) Sdl has a main replacement macro on Windows an MacOS, so it > looks like at least on those two platforms I'll have to do something > fancier than just some SWIG wrappers. You can tell SWIG to ignore various parts of the interface. But if you have a Linux system I'd suggest using that for development; it's usually the least problematic, and porting quirks can be ironed out later. I have some experience with that, at least on Windows. ;-) > I'm going to start down the path of having a separate "qsdl" binary > which will include libsdl support, and will eventually automatically > load and initialize the sdl library as well. Does anyone have any > other suggestions how to make this work? Well, writing a C wrapper module is one solution (I also did that with that xine module, IIRC), but it kind of defeats the purpose of using SWIG. If the SDL header files are too messy, then it's also possible to just provide the prototypes of types and functions that are to be wrapped in the .i file, or selectively replace some of the functions of the interface while retaining others. You can find examples of this in the sqlite3 and opengl wrappers. But I would first try to just %include all the relevant header files in your .i file and see what q-swig generates from that. Take a look at the generated .q source and maybe the _wrap.c file, and try the most important operations (e.g., initialization, finalization) in Q. If something doesn't work as it should then you can start working from that, replacing broken wrapper functions with your own code. That's the way we did it with the opengl and openal interfaces, and I guess it's the only way to stay sane when trying to wrap bigger libraries. ;-) Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |