[plt-scheme] C interface and inspectors

From: Dmitriy.Zavin at infineon.com (Dmitriy.Zavin at infineon.com)
Date: Wed Aug 11 15:05:29 EDT 2004

Hi,

I am using SWIG to get my code into mzscheme and so far so good. I have
decided to generate structs for my internal structures instead of going
with the default swig way of making accessor functions to opaque
pointers. 

new_type = scheme_make_struct_type(scheme_intern_symbol(basename),
                                       NULL /*super_type*/, 
                                       NULL /*make_inspector(0, NULL)*/,
                                       num_fields, 
                                       0 /* auto_fields */,
                                       NULL /* auto_val */,
                                       NULL /* properties */); 

So in my code I do a call to scheme_make_struct_type (as above), and
then make names/values. The problem I am having is how to supply a new
inspector to the struct when I am creating it. make_inspector() (as seen
in comment) (from src/struct.c) doesn't have a prototype in scheme.h,
and is not a dynamic symbol so my module refuses to load; which leads to
my question. Is there a reason why make_inspector() should/could not be
called from an outside module that will be loaded into mzscheme? 

How should I go about creating an inspector for my struct? I would like
to use it because I want to serialize my structs with struct->vector and
pass across a network socket (which I already know how to do).

Sorry for a lame question, but there is practically no information
regarding the use of inspectors when it comes to mzscheme library
access.

Thanks in advance for your help.

--Dima



Posted on the users mailing list.