_NSAutoreleaseNoPool(), glcaml, SDL and ocaml
I'm starting to learn ocaml and I've been trying to get some libraries to compile so I can eventually do some game programming with it. I successfully got ocaml installed and compiled glcaml but when I run any of the examples I get a ton of error spam.
Given that the developer of GLcaml doesn't officially support OS X (I'm guessing he doesn't have a mac) I thought you guys would know more since this seems to be an OS X thing. I've searched around the forums and google but none of the threads seem to have conclusions. I'm hoping that I can get this fixed and send a version back to the developer so more people can use it (including myself).
Any ideas?
Code:
SAutoreleaseNoPool(): Object 0x322040 of class NSMutableParagraphStyle autoreleased with no pool in place - just leaking
2007-02-03 00:42:35.419 test[2770] *** _NSAutoreleaseNoPool(): Object 0x322280 of class NSCFDictionary autoreleased with no pool in place - just leaking
2007-02-03 00:42:35.420 test[2770] *** _NSAutoreleaseNoPool(): Object 0x324230 of class NSCFNumber autoreleased with no pool in place - just leaking
2007-02-03 00:42:35.420 test[2770] *** _NSAutoreleaseNoPool(): Object 0x324730 of class NSCFNumber autoreleased with no pool in place - just leaking
2007-02-03 00:42:35.420 test[2770] *** _NSAutoreleaseNoPool(): Object 0x324740 of class NSCFNumber autoreleased with no pool in place - just leaking
...(many more errors like the ones above here)...
2007-02-03 00:42:35.459 test[2770] *** Uncaught exception: <NSInternalInconsistencyException> Error (1002) creating CGSWindow
Trace/BPT trapGiven that the developer of GLcaml doesn't officially support OS X (I'm guessing he doesn't have a mac) I thought you guys would know more since this seems to be an OS X thing. I've searched around the forums and google but none of the threads seem to have conclusions. I'm hoping that I can get this fixed and send a version back to the developer so more people can use it (including myself).
Any ideas?
This came up (though not in relation to CaML) recently. I believe the resolution was that the developer wasn't using SDLMain.m.
I have no idea how you do that with CaML though -- that's up to you
I have no idea how you do that with CaML though -- that's up to you
Thanks, that helps a lot. Although I'm not sure of how ocaml uses C files I'm sure the developer does. I sent him an email explaining the problem and hopefully he can help. I'll let you guys know when this is working correctly.
Edit:
While I haven't heard back from the developer for the proper way to fix the makefiles I messed around a little and got a little farther. apparently ocaml can build executables with ocaml object files and c object files. the proper syntax for compiling lesson 7 is as follows:
however now I get another error message which is most likely harder to fix.
since the code entry point is in an ocaml file and not in a c file this makes things a little difficult. I tried changing the int main in SDLMain.m to SDL_main and it compiled and when it ran it came up with a menu and an icon in the dock but no window. My guess is it just called cocoa to make a window and didn't even enter the ocaml code. Is there a way to trick sdl so it can run the real entry point and not the one in SDLMain?
Edit:
While I haven't heard back from the developer for the proper way to fix the makefiles I messed around a little and got a little farther. apparently ocaml can build executables with ocaml object files and c object files. the proper syntax for compiling lesson 7 is as follows:
Code:
ocamlc -custom -I lib/ -I src/ -ccopt -Llib/ -ccopt -Lsrc/ bigarray.cma unix.cma lib/sdl_stub.o src/SDLMain.o lib/glcaml_stub.o -cclib "-framework SDL -framework cocoa" -o bin/mytest lib/sdl.cmo lib/glcaml.cmo src/lesson07.cmoCode:
/usr/bin/ld: Undefined symbols:
_SDL_main
The one in main just initializes some important cocoa stuff for your app to run.
You've got to include Sdl.h in the file where your 'real' main is located, and just add sdlmain.m to your makefile.
You've got to include Sdl.h in the file where your 'real' main is located, and just add sdlmain.m to your makefile.
That might help the developer of the library but as far as I know there is no way to include a C header file in ocaml.
So I finally got it working the other day and I typed up a summary of what I did along with including the modified project file. If anyone finds them self in the same situation then I suggest you take a look at http://www.seoushi.com/index.php/Ocamlsdl_mac .

