Renaud De Landtsheer wrote:

I am interfacing a data structure library to OZ.
The library is written in C.
Many functions of the library return "a pointer to something".
I want my OZ code to store a "pointer to" the structures stored within the library.

To what kind of OZ value can I transform a C pointer?
* Integers are implementation-dependent in OZ. Can a pointer always fit into a MOZART integer? * atoms are never garbage-collected and there might be a lot of different pointers in the application (memory consumption is an issue)
*strings, maybe?

Note that
* I do not want to convert the complete data structure manipulated by the library into OZ structures. * I am aware of the "garbage collect" issues, but this is not the topic of this mail.

Thank you!

--
Renaud De Landtsheer


_________________________________________________________________________________ mozart-users mailing list [email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

mozart.h defines the functions:

OZ_Term OZ_makeForeignPointer(void*)
void* OZ_getForeignPointer(OZ_Term)
int OZ_isForeignPointer(OZ_Term)

which allows to encapsulate a C pointer in an Oz value.
The only thing that can be done with this kind of value in Oz is to pass it to another C function.

Yves

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to