Page 1 of 1

Calling a DLL Function

Posted: Wed Apr 01, 2009 12:23 am
by ac667788
How would you guys call this DLL Function

void hesl::version(int *major, int *minor, char **verstr);

I tried the following and the values at *major and *minor are okay but I don't know how to handle char **verstr

Code: Select all

  *major = @major.i
  *minor = @minor.i
  version.s = ""
  *version = @version.s
  CallFunctionFast(*F, *major, *minor, *version)

Posted: Wed Apr 01, 2009 12:29 am
by netmaestro
PeekS(*version) would be my guess.

Posted: Wed Apr 01, 2009 1:01 am
by ac667788
PeekS(*version) gives me the same garbage as before

Posted: Wed Apr 01, 2009 1:47 am
by Deeem2031
Try @*version as the last parameter.

Posted: Wed Apr 01, 2009 1:56 am
by ac667788
Changes things a bit but the data at

version
*version
@*version

is still garbage

Posted: Wed Apr 01, 2009 2:13 am
by jack
is the function in the DLL CDECL or STDCALL , maybe try CallCFunctionFast ?

[edit]
try this

Code: Select all

version.s
*ptr
CallFunctionFast(*F, *major, *minor, *ptr) 
version=PeekS(*ptr)
[/edit]

Posted: Wed Apr 01, 2009 10:44 am
by srod
I think you will also need to allocate a buffer first because it looks like the function will write a string directly into this buffer.

Code: Select all

version.s = Space(1024) 
CallFunctionFast(*F, @major, @minor, @version) 
Perhaps using CallCFunctionFast() instead as Jack suggested.