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 651 - (download) (annotate)
Thu Jun 1 18:34:03 2000 UTC (21 years ago) by monnier
File size: 945 byte(s)
bring revisions from the vendor branch to the trunk
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