Hi all:
I have in C in a library:
typedef struct __tsPMDevInfo { ... some slots in here; don't matter ...
} tsPMDevInfo, *ptsPMDevInfoPtr;
// ------------------------------------------------------------------------ // nFindPMs -- Find PM Devices on all available serials // ------------------------------------------------------------------------ -
int nFindPMs( ptsPMDevInfoPtr **pppsPMDevInfoArray, int *pnNrPMsFound ) { int nRC = 0;
ptsPMDevInfoPtr *ppsPMDevInfoArray = NULL;
.... Here, memory gets allocated and ppsPMDevInfoArray points to an array of pointers to struct tsPMDevInfo !
if( pppsPMDevInfoArray != NULL ) *pppsPMDevInfoArray = ppsPMDevInfoArray;
if( pnNrPMsFound != NULL ) *pnNrPMsFound = nNrPMs;
if( nNrPMs > 0 ) nRC = PMIO_RC_OK; else nRC = PMIO_RC_NO_PM_FOUND;
return nRC; }
In Lisp-land I do (simplified):
(defcfun ("nFindPMs" %nFindPMs) pmio-rc (ppsPMDevInfoPtr :pointer) (pnNrPMs :pointer))
(defun find-pms (ppsPMDevInfoPtr pnNrPMs) (%nFindPMs ppsPMDevInfoPtr pnNrPMs))
I do get a valid value for the nr of PMs back with
(mem-ref pnNrPMs :int 0)
But I am unable to get a valid foreign pointer back for ppsPMDevInfoPtr :
(mem-ref ppsPMDebInfoPtr :pointer 0)
always returns an invalid value (no valid memory address). So, the question is: How do I return a pointer to an array of pointers ? In C land everything is OK and the pointer array is valid: check via ppsPMDebInfoPtr[0] -> This is the pointer to a valid struct tsPMDevInfo.
Thx for any pointers ;-) !!!
Frank