Anyone want to try writing a CS5 plugin with BMAX?
BlitzMax Forums/BlitzMax Programming/Anyone want to try writing a CS5 plugin with BMAX?
| ||
Show me that it can be done. I haven't really seen any bmx-made dll's popping up. Here's the PureBasic version:#PLUGIN_EXPORT=1 ProcedureDLL PluginClass(*inbuffer,insize,*outbuffer,outsize) PokeL(*outbuffer,#PLUGIN_EXPORT) EndProcedure ProcedureDLL PluginDescription(*inbuffer,insize,*outbuffer,outsize) PokeS(*inbuffer,"Dump export data") EndProcedure ProcedureDLL PluginLabel(*inbuffer,insize,*outbuffer,outsize) PokeS(*outbuffer,"Dump export data (*.txt)") EndProcedure ProcedureDLL PluginFileExtension(*inbuffer,insize,*outbuffer,outsize) PokeS(*outbuffer,"txt") EndProcedure |
| ||
You can't create DLLs straight with BM and using the DLL creator is a story on its own. We will have to wait for BMK sources then this shouldn't be much of a problem :-) But without the constants and CS5 datastream format there is not much to be exported ;-) |
| ||
First thing is just getting a dll compiled so that it will show up in the editor. After that, I will provide the data format. |
| ||
ok, will do that when we have a straight dll compile option :-) |
| ||
Ok, give this one a try... http://www.svenberra.net/CSPlugin.dll OBS! In your example of the PluginDescriptionfunction you poke the string into the inbuffer. I assumed this was a typo and my dll will poke the string into the outbuffer instead, like the other functions do. I found an easier method to compile DLL's which doesn't require MingW or the requirement to compile the source as a mod. |
| ||
I also want to mention that this method also support mod imports. However, when I try calling Notify or Print the dll will crash. I'm not sure why but perhaps Notify and print is dependant on a window instance(hwnd) which it won't have if called from inside a dll. Calling win32 API functions was no problem though. It also supports proper DLL handling, that is, a DllMain function that triggers when the DLL is first loaded, attached, detached and unloaded. |
| ||
Sweenie, it works. I'm still not happy with the idea of compiling my engine in BlitzMax, though, through an unofficial DLL compiler. PureBasic pretty much has no debugging info. Nothing useful, anyways. IBasic Pro is the one I know the least about, but unless BlitzMax dll compilation is supported officially, or proven to be extremely reliable, I can't use it. |
| ||
what is CS5? Character Studio? |
| ||
I'm still not happy with the idea of compiling my engine in BlitzMax, though, through an unofficial DLL compiler. Well, it's not that "unofficial" as the DLL-compilation goes through exactly the same process as the Bmax executables except for the last step (the linker) there I add the --dll parameter and add the export definition file. I call the Bmax bmktool to compile the source as an ordinary exe and since the compiled objectfile(.o) isn't removed afterwards, I just repeat the linking step(ld.exe) to link the objectfile and all the dependencies to a dll aswell. I'm 95% sure that the DLLs are valid, but I understand if you want an official thumbs up from the Bmax team. |