Re: wrapping C code - my exercise in incompetence.

new topic     » goto parent     » topic index » view thread      » older message » newer message

I uploaded a library to allocate, write, read and free structures in memory. Pointers and variables are automatically sized according to OEU version and OS Architecture.

Here is an example of use, no matter if your system is 32-bit or 64-bit, no matter if you use OEU 4.05 or OEU 4.1.

atom p = NULL 
atom s1 = allocate_string("A string") 
p = allocateStructure(p, {C_POINTER, C_INT, C_FLOAT} ) 
writeStructure(p, {C_POINTER, C_INT, C_INT}, {s1, 12, 25.2} ) 
sequence s2 = readStructure(p, {C_POINTER, C_INT, C_INT} ) 
printf(1, "s2[1] = %s, s2[2] = %d, s2[3] = %4.1f\n", {peek_string(s2[1]), s2[2], s2[3]}) 
freeStructure(p, {C_POINTER, C_INT, C_INT} ) 

Jean-Marc

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu