devilyn Posted February 14, 2013 Share Posted February 14, 2013 (edited) 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) _ArrayDisplay($sum) dll is attached. thxDllExport.7z Edited February 14, 2013 by devilyn Link to comment Share on other sites More sharing options...
Mat Posted February 14, 2013 Share Posted February 14, 2013 Problems: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. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Mat Posted February 14, 2013 Share Posted February 14, 2013 (edited) 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 February 14, 2013 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now