I glossed over the fact that my program crashed at the end of the script in my post on hooking up Lua to a C++ application. I new at the time I posted that there was a memory problem in calling the SimpleGraphics destructor but what I didn't realize was that the problem was actually caused by the difference in the declaration of the SimpleGraphics class between the header file that the C++ program sees and the declaration that the SWIG-generated file sees. Here's the one that gets compiled in to the C++ application:
I closed off my last post about adding Lua to an SDL application saying I’d look at a tool to do the bindings for me. I actually already had something in mind for the job. I looked at a couple but SWIG seems to be the most versatile. It’s not tied just to Lua so the work I put in to learning how to use SWIG will also apply partly to any other scripting languages I want to support. Any within the realm that SWIG supports, of course. Notably missing from the list so far is Javascript. Scheme is represented in the form of Guile (which is a specific Scheme interpreter as far as I understand).
The documentation for SWIG is pretty sizable but of course with all the combinations of host & script language out there they aren’t all explained clearly enough for a beginner like me. So I started to experiment. SWIG focuses on wrappers for C, C++ support seems more complex. So to understand things I had to scale back even from my simple SDL C++ test program then scaled back up once I got some communication between code written in both languages.
I've heard complaints about dealing with managed code and headaches dealing with mixing managed and unmanaged code but for the most part these problems have been just bits of conversation to me. Until now. See, the last version of Visual Studio that I used for really intense work was VC6. I still feel that the product's been riding down the crapwave ever since. In the interim most of my work has been in Linux or cross-platform script stuff. I've got a little project that I'm currently trying to get building on Visual Studio 2003. It uses SDL and Lua. Basically I want to build a little test harness, but more on that later.
I already had the project building in Linux using just the SDL libraries then I created a project in VS2003 to build the same source. I followed the description from this thread on GameDev.net. The SDL project built and all was well.
A lot's been going on at home lately, Candace and her brood are coming to live with me and my daughter. We're doing piles of construction in the basement to get bedrooms built. We're all excited and working hard to get stuff done this summer. More importantly though, it is now normal for there to be five computers in my living room (none of which are really meant for my use any more, but that's beside the point). Any of six residents can be in the house at any given time. There are also cases where we might log in remotely: for email, SSH access or a couple other web applications that I run on one of the machines like a wiki and calendar. Then there's Asterisk, which I haven't had up lately but desperately want to get back online.
Obviously we need to have some common file storage locations and control for access to those locations. So I've decided to look more seriously into setting up LDAP. Currently one of the machines dual boots Windows XP and OpenSuse 10.2. Another one (that I use for a Myth TV front end) runs OpenSuse 10.1. My desktop is full-time OpenSuse 10.2 for now, though I might be pressed to also install Windows Vista soon (resisting with all my might). Let's see... that leaves the two laptops. They run Windows XP. Oh, I almost forgot about the old DOS box I put in the garage to run the CNC. I'll not worry about it for the moment.
A while ago I started thinking about running World of Warcraft on Linux, and someone even left me a note about a petition for a Linux-native client a month or two ago too. I'd love to see a native client for WoW in Linux, but that's not here today. So I turned to Wine for the first time in years.
I tried Wine way back when I first installed Debian Linux in 1998. Things were different then. I'd wanted to try out Linux before then but I was help up by lack of support for exotic things like IDE hard drives. Yes, it was a different time. I was tied to a lot more closed-source Windows apps, like the brilliant IRC client mIRC. So my experience with Wine was trying to get mIRC running without really understanding Winsock, sockets, or any of that stuff. The program would start but never connected. Let's just say I was left wanting.
While I've been off doing my own thing, the Wine team has been hard at work and they've done some amazing things. Amazing things like working without an installed copy of MS Windows on your machine, supporting some DirectX stuff and generally taking a lot of the pain out of running Windows applications on Linux. My new desktop is a single-boot machine so far. I might try out MS Windows Vista some day, but I'm not in any hurry.
So the other day I started thinking about how fast my AMD 64 X2 4200+ computer is compared to my year-old Compaq R3000z laptop that I've been running WoW on. I read about some very positive experiences with WoW on Wine under other Linux distros.