Trying to use dll (created in blitzmax) in Blitz3d

BlitzMax Forums/BlitzMax Beginners Area/Trying to use dll (created in blitzmax) in Blitz3d

Pax(Posted 2010) [#1]
Hello, I'm trying to use a .dll created in bmax in blitz3d.
I am able to run the program but I get a MAV, and the string is all garbled up.

Any idea?

dllTest.bmx



dllTest.def


dllTest.decls


and finally test.bb



Floyd(Posted 2010) [#2]
Strings in BlitzMax, declared as something$ or something:String, now use 16-bit characters by default.
For old style 8-bit, null-terminated C strings ( which Blitz3D expects from a DLL ) you use something$z.

I've never tried a BlitzMax DLL so this is really guesswork. But try using the $z type tag for any strings going to or from Blitz3D.


Dreamora(Posted 2010) [#3]
you use GCEnter, where is the other half before the return?


Pax(Posted 2010) [#4]
Hello guys, thank you a lot for your answers. Sorry for the late repply, had to travel out of the city.

Floyd, it must be that 16 bit thing, however bmk complaints:
"Compile Error: Illegal variable type"
When specifying $z. Searching the forums it seems I might have to use .toCstringt, however I don't know how to specify the return type of the function.

Dreamora, I didn't know I had to use another command, as was just trying the dll functionality and found GCEnter() on other forum threads. Which function complements it?

After adding "Win32" after the function name, blitz3d doesn't has the MAV anynmore. Now jsut need to "fix" the text return.

Thanks again for your advice.


Nate the Great(Posted 2010) [#5]
I thought you couldnt make dll's with bmax? I guess I was wrong... so how do you make it a .dll surely its not just a matter of renaming it.


Azathoth(Posted 2010) [#6]
I thought you couldnt make dll's with bmax?
Its experimental and not officially supported.


Pax(Posted 2010) [#7]
Hi Nate, I am basing on this:

http://blitzbasic.com/Community/posts.php?topic=66616

Somewhere I read that GCEnter() was advised, that's why I added it.