Arrays of CStrings

BlitzMax Forums/BlitzMax Programming/Arrays of CStrings

teamonkey(Posted 2005) [#1]
I've got a C function in a Max module that requires a callback that I would like to write in Max. The trouble is that it uses an argc/argv sort of thing, where argv is an array of incoming c strings and argc is the number of strings.

In C it's this:
int callback(int argc, char **argv);

I've tried many things in Max with no success:
Function callback:Int(argc:Int, argv:Byte Ptr[])
Function callback:Int(argc:Int, argv:Byte[][])
Function callback:Int(argc:Int, argv$z[])
Function callback:Int(argc:Int, argv$z Ptr)

Either these don't compile or I can't seem to access the C strings.

Does anyone know the correct way to do this?


skidracer(Posted 2005) [#2]
try this:
Function callback:Int(argc:Int, argv:Byte Ptr Ptr)
End Function

or if it's a windows stdcall function:
Function callback:Int(argc:Int, argv:Byte Ptr Ptr) "win32"
End Function



teamonkey(Posted 2005) [#3]
Perfect! Many thanks.

Nearly done now. :)