I have a dylib that has a prototype for a function like
extern int discover(char ***path_array);
In C I'd call it like
char **paths ;
int i ;
int j ;
i = discover(&paths) ;
for ( j = 0 ; j < i ; j++ )
printf("%s\n", paths[j]) ;
In RB 2005r4 I have obviously missed something trying to do
soft declare function discover lib "lib.dylib" (path as Ptr) as integer
dim paths as new memoryblock(4)
dim i as integer
dim j as integer
i = discover(paths)
So far so good
but now what ???????????????????????????
I've tried several things
I know the value in paths.Long(0) is the address of a block of
pointers to pointers, each of which is 32 bits.
So I thought something like
paths = paths.Ptr(0) // now paths references the block of pointers
for j = 0 to i - 1
dim apath as string
apath = paths.Cstring(j * 4)
next
but that does not work. CString seems to just read bytes until it
hits a 0 byte.
OK, paths.Cstring(j * 4) is an address. So lets get to the actual
data that address references.
paths = paths.Ptr(0) // now paths references the block of pointers
for j = 0 to i - 1
dim apath as string
dim theData as new memoryblock(4)
theData.long(0) = paths.Long(j * 4) // the specific pointer for the
string
theData = theData.Ptr(0)
apath = theData.Cstring(0)
next
This also does not work
I'm open to suggestions as I've obviously done something really dumb
here
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>