CallDll vs User libs

Blitz3D Forums/Blitz3D Programming/CallDll vs User libs

verfum(Posted 2004) [#1]
If you use CallDll you can return a large amount of data from the Dll back into Blitz via a Bank of memory.

Is this possible with user libs?

As far as I know you can only return a single float or int.


Kanati(Posted 2004) [#2]
all a bank is, is an integer pointer to the bank. So you use them the same.


verfum(Posted 2004) [#3]
So what you're implying is that I can do this? ...

C++ User lib implementation

int MyFunc(void)
{
static int memory;
return (int) &memory;
}

and in Blitz

memory_bank = MyFunc()
memory% = PeekInt(memory_bank,0)


Spinduluz(Posted 2004) [#4]
I'm [EDIT*] ->NOT<- exactly sure what you want to do. But if you want to manipulate blitz bank data in C/C++ then this should do it.

C++ part

void MyFunc(int *bank)
{
*bank = 1234567;
}

Blitz

Bank = CreateBank(4)
MyFunc(Bank)
Print PeekInt(Bank,0)
FreeBank(Bank)




verfum(Posted 2004) [#5]
Ahh, so it doesn't take a copy of Bank and pass it to MyFunc.

So you just manipulate Bank in your User lib and this makes the changes in Blitz.

Thanks Spindeln, I think this is what I need.