passing pointer to dll function

BlitzMax Forums/BlitzMax Programming/passing pointer to dll function

gameshastra(Posted 2007) [#1]
Hi,
I am trying to pass a pointer to the a dll function

the code in BlitzMax is as follows:

Local width:Int=0
Local varbnk:TBank=CreateStaticBank(Varptr width,4)
DllFunction(Varptr width)

In the c++ code:
int DllFunction(int *width)
{
printf("%d",*width)
}

The variable is not getting passed properly

Please advise


gameshastra(Posted 2007) [#2]
I also tried passing Varptr width directly to function but it didn't work.

I could not get any help from previous posts so I hope to get some help here


Brucey(Posted 2007) [#3]
extern
  function DLLFunction:int(width:int ptr)
end extern


local width:int = 5

DLLFunction(varptr width)



gameshastra(Posted 2007) [#4]
I am Getting the DllFunction using LoadLibraryA
Local DllHandle=LoadLibraryA("dllname")
Global DllFunction(width:Int Ptr)"win32"=GetProcAddress("dllname","DllFunction")

Then Calling DllFunction(Varptr width)
This doesn't work


gameshastra(Posted 2007) [#5]
My C++ code :
DllFunction(int *width)
{
using or modifying *width
}
I am derefencing the pointer in the c++ code using *width
Shouldn't that should be OK?


gameshastra(Posted 2007) [#6]
Not yet resolved


gameshastra(Posted 2007) [#7]
Found the problem. That was a misdiagnosis.
Thanks