[Ecls-list] build lisp array in C
Eric Schulte
schulte.eric at gmail.com
Thu Jun 30 22:18:58 UTC 2011
Hi,
While I'm generally having success using lisp objects from within C, I
am unable to successfully create a lisp array from a list of C ints.
For example the following throws invalid memory access errors [1] on the
first call to si_aset...
int i, length;
length = 5;
int c_bytes[5];
for (i=0; i<length; i++){
c_bytes[i] = i;
}
cl_object bytes = cl_make_array(1, MAKE_FIXNUM(5));
for (i=0; i<length; i++) {
printf("%d ", i);
si_aset(3, bytes, fix(i), fix(c_bytes[i]));
}
Am I doing anything obviously wrong, or is there a better way? I found
nothing on the wiki [2], but when I find a working solution I'll be sure
to post it there.
Thanks -- Eric
Footnotes:
[1] specifically
,----
| Condition of type: SEGMENTATION-VIOLATION
| Detected access to an invalid or protected memory address.
`----
[2] http://ecls.wikispaces.com/C+and+lisp+conversion+functions
--
Eric Schulte
http://cs.unm.edu/~eschulte/
More information about the ecl-devel
mailing list