Saturday, April 18, 2009

Scala + SDL


Gradients RuleAfter spending a lot of time doing pointless things, I finally got SDL to work with Scala. Actually, there was nothing tricky about the fact that I was using Scala, that was just part of my original goal. You could equally well say I couldn't get SDL to work with Java. It was pretty obvious that I needed to download SDL.dll and the bindings for Java (both a jar file and some more DLLs), but even then things still weren't working. I was getting the dreaded java.land.UnsatisfiedLinkError. 

Turned out I needed to do three things...
- Add -Djava.library.path= as a VM argument, giving it there folders where both the SDL DLLs and the sdljava DLLs were located.
- Add System.loadLibrary("XXX") for each of the required DLLs into the code itself. This is difficult because it's kind of hard to figure out which DLLs are required! I used this tool to figure it out. 
- Lastly, the biggest problem was that I needed a DLL that I didn't have, SDL_image.dll. The tutorial I was using needed it, but I guess it didn't say or I didn't see where I needed to download it separately. You can get it here.

1 comment:

  1. I had the same problem and fix t easily using http://fix4dll.com/msvcr100_dll just find the file you need and add it into system 32 folder on your device. Good luck.

    ReplyDelete