Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/smlnj-c/libs/binC2ML/README
ViewVC logotype

View of /sml/trunk/src/smlnj-c/libs/binC2ML/README

Parent Directory Parent Directory | Revision Log Revision Log

Revision 249 - (download) (annotate)
Sat Apr 17 18:57:03 1999 UTC (22 years, 3 months ago) by monnier
Original Path: sml/branches/SMLNJ/src/smlnj-c/libs/binC2ML/README
File size: 945 byte(s)
version 110.16
The functor binaryC in the files
can be used to convert binary C data (e.g. structs) into their
SML/NJ C interface equivalents.  This is useful for importing 
C binary data from files, for example.

To use the convertor, instantiate a C interface for the source
C data.  Note that it is possible to import C data created by a 
C compiler with different characteristcs (e.g. sizes) than the
target (SML/NJ) platform.  Then, instantiate the binaryC functor
with this C interface.  The function toBits converts an SML/NJ
ctype instance to bits in a Word8Vector.  Conversely, the function
fromBits converts the bits in a Word8Vector, given a ctype, to 
the corresponding C data.  

The toBits/fromBits operations are valid only on flat types; no
pointers or functions.  binaryC raises an exception when asked
to convert non-flat types.

The file load.sml serves to illustrate the process described above.

ViewVC Help
Powered by ViewVC 1.0.0