Please explain how CallDll works

Blitz3D Forums/Blitz3D Beginners Area/Please explain how CallDll works

djr2cool(Posted 2004) [#1]
The calldll function has to be the weirdest function of all. In the help files it says , out_bank (optional) - handle of bank that is made available from dll procedure to blitz.

now i am useing purebasic to make dll's and had gotten to the point where i find out that i can not write anything to the out_bank part of command. but i can read write back to the in_bank.

just as a test i wanted to read the values from the inbank with a peek and poke those same values back to the outbank side. but it always crashes.

so i thought maybe i wasnt addressing the banks the right way in purebasic. so i tried something else, i peeked the values on the inbank and they were just fine. then i poked different values into the same inbank address, and bingo it works.

so my question really is, whats the outbank for, if i cant write to or read from outbank.


AntonyWells(Posted 2004) [#2]
If you're using purebasic I'd suggest using Decls to implement the functions as you can then call the .dll calls directly.

But failing that, outbank allows you to write data to it. If it's not changing it's because you're writing in the wrong part of memory.

Remember you're only passing PB a pointer(Memory address) to the banks location. So, use POKEB at that passed integer handle to write data to it. I.e pokeB(addr+1,blah blah) pokeB(addr+2,blah blah) (In pb that is)

Read it as normal once returned.


Floyd(Posted 2004) [#3]
CallDLL was something of a stopgap method of using DLLs in Blitz.
This was before userlibs were implemented. These are now the proper way to use DLLs.

You can ignore CallDLL.


Bremer(Posted 2004) [#4]
Could someone post an example of how you use decls to call a purebasic dll directly?


soja(Posted 2004) [#5]
It's the same as calling any other exported function in any other DLL. Have you looked at the example under Specs and Utils? You can also see a ton of examples just by searching for ".lib" in the forums.

Basically, once you define a command in a .decls file, you can use it as if it were a BB command/function.


Bremer(Posted 2004) [#6]
Thanks, I found out why it didn't work. I didn't have a * after the bank name in the declaration and that was the only thing keeping it from working.