[SDL] Attempting to make SDL wrapper for QB64 - First hurdle!

David Olofson david at olofson.net
Tue Dec 7 11:41:21 PST 2010

On Tuesday 07 December 2010, at 17.22.24, Alex Barry <alex.barry at gmail.com> 
> If QB64 can't handle pointers, then I don't think there is really any way
> that you can port SDL (which almost exclusively uses pointers for it's data
> types).

Uhm... There are several languages without pointers (including my own EEL) 
that have SDL bindings - and this often comes with additional bonuses such as 
automatic memory management and a nicer, safer API than the C version.

What you do is just wrap the "API objects" in whatever way makes most sense in 
the language at hand. In EEL, I wrap them up as "objects" (memory managed 
entities with an interface based on a fixed set of methods), which are then 
handled by means of opaque references. That is, essentially pointers to 
wrapper objects, but all wrapped up and "fool proof". Most VM based scripting 
languages, and many others, would support this model, I think.

For a language that doesn't support "native" objects or custom types AT ALL, 
there is a salution that is actually pretty common in native C APIs: integer 
handles - or as OpenGL (among others) calls them: "names." You can implement 
some variant of this even if you have only a single data type, be it strings, 
integers, real numbers, "bignums" or whatever.

> I'll chat with Galleon to see where he's at for implementing pointers
> (which probably should have been done at QB64's first launch!).
> I'll let you know what I find out and I'll get back to you.

If you have a language that is already getting by just fine without pointers, 
why open up that massive, evil can of worms at all? In a high level language, 
pointers don't really solve anything that cannot be handled much better with 
other constructs.

Well, either way, that's pretty off topic for this list, anyway. :-)

//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.--- Games, examples, libraries, scripting, sound, music, graphics ---.
|   http://consulting.olofson.net          http://olofsonarcade.com   |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20101207/f8dcd8c8/attachment-0008.htm>

More information about the SDL mailing list