[Gtk-sharp-list] Wrapping Tool?

Charles Iliya Krempeaux charles@reptile.ca
04 Mar 2003 01:31:25 -0800


It would be very useful, when wrapping C libraries by hand, if there
was a "tool" to get certain "things" from C header files (or
whatever) and translate them to C#.  (This would help make
Gtk# more portable too.)

For instance, consider "time_t".  On one system, it might
be 32 bits long.  Another system, it might be 64 bites

However, when creating a wrapper, we are forced to choose
a particular size.  For example, in my code I have:

          using time_t = System.Int32;

This would NOT work (properly) on a system where "time_t"
is 64 bits.

(I use a "using alias" to make it so I can make things easier
to maintain.  Most the code seems to make the translation
everywhere... which makes thing much much more difficult
to alter.)

What we need is something that can "preprocess" files, and
change C types to the appropriate C# type for that system.

Maybe, have code like:

    @C_TYPE(time_t)@ time;

And the preprocessor would change this to:

    System.Int32 time;

(Or whatever is appropriate for the system.)

Is there such a tool like this???

See ya

     Charles Iliya Krempeaux, BSc

 Reptile Consulting & Services    604-REPTILE    http://www.reptile.ca/