Code: Select all
char* foo(int index, int* retval);
You are intended to iterate over the table from 0 on up, and stop when it returns the NULL pointer.
I beat my head on this for an hour, I was doing:
Code: Select all
(import MY_LIB "foo" "char*" "int" "void*")
I tried various things to detect when (foo) was returning a NULL pointer. I tried (get-long (address)), I tried (address), I tried (get-long), I tried (get-long (get-long)), etc.
Finally I switched the import statement to void* instead of char*
Code: Select all
(import MY_LIB "foo" "void*" "int" "void*")
So, I'm using void* for now, but it would be nice to go back to using char*, char* works when I do regular (not extended) import of function foo, and the char* integration with native newlisp strings is really nice, not having to do the extra get-string step, especially because I'm dealing with a library that brings in binary data, and the strings are not \0 terminated ones.