Mod Writing
BlitzMax Forums/BlitzMax Programming/Mod Writing
| ||
Just experimenting with writing my own mods... So just to start small and work my way into it, I tossed the following together. C Code... #include <conio.h> int bbGetKey(void) { return kbhit(); } BMX Code... Module Pub.GetKey ModuleInfo "Version: 1.00" ModuleInfo "Author: Kanati" ModuleInfo "License: Public Domain" ModuleInfo "Copyright: STONEhenge Software" ModuleInfo "ModServer: BRL" Import "getkey.c" Extern Function bbGetKey:Int() End Extern Function GetKey:Int() Return bbGetKey() End Function Obviously this is just a test... But the module compiles fine. And the test program compiles fine. But hangs when ran. Anyone see anything obvious with that that I am not catching? Also... How would I go about compiling my module only instead of all modules as I would through the Program menu? |
| ||
You may want to test it from a proper console, the IDE probably needs a feature to provide such a thing rather than redirecting the process standardio as it does now. As for module rebuilding, I think there is an option (check runtime help of bmk.exe) but with quick build always enabled I have never seen the need to investigate. |
| ||
Your sample works fine here (thanks by the way :-). I ran the following test program successfully (maybe there is a problem with your test program which you didn't post?) Repeat a = bbGetKey:Int() If a <> 0 Then Print a EndIf ForeverYou can stop it with ctrl-c. The compilation you can do with '.\bin\bmk.exe makemods abc' assuming that you put your .c and .bmx file into '/mods/abc.mod/test.mod'. |
| ||
Ah. Thanks. Glad that works too. I didn't think it would actually. :) |
| ||
But what about struct or class import from C code ? I'm working on a MD2 loader mod but don't know how to transfert typedef of class from c to bmx ... any ideas ? this would be a great thing |