Jump to content
Sign in to follow this  

help with dllcall

Recommended Posts


extern "C" __declspec(dllexport) char** test()
static char* myArray[3] = {"A1", "BB2", "CC3"};
return myArray;

im trying to get the array from the function above using dllcall

this is what i got so far

Global $sum = DllCall('DllExport.dll', 'str', 'test')
If @error then MsgBox(0,"e",@error)

dll is attached.



Edited by devilyn

Share this post

Link to post
Share on other sites


  • Return type is not 'str'
  • You are using the cdecl calling convention, so your return type would be 'ptr:cdecl'
  • AutoIt can't use your dll as you've attached anyway. I suspect that means its not a native dll.
  • I suspect when you close the dll you'll lose the static variable.
Unfortunately I don't have access to a compiler to rewrite your dll at the moment.

You shouldn't allocate memory from within the dll function anyway, its standard practice that the caller should allocate and free the memory. Trying to work with an array of C strings is going to be tricky anyway, perhaps a callback function for each item would be a better approach.

Share this post

Link to post
Share on other sites

You know, I don't actually know how to compile a dll to MZ format. How did you do that?

You learn something new every day. I never knew that PE dlls kept the MZ magic number :)

Edited by Mat

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this