In ForeignTest, the vol2tree method use fromClong to differentiate between NullTree, or Tree. My union, is made of 2 variants : a struct pointer and a int64_t . I can't figure out how to decide if a given vol is a pointer or an int64_t. is there a solution ? The inverse conversion is pretty forward
Le Lundi 20 Août 2012 10:47 CEST, David Matthews <[email protected]> a écrit: > Hi, > I guess you would want to map between a union in C and a datatype in ML. > That would require the union type to contain sufficient information to > allow the conversion process to know which variant of the datatype to > use, which isn't necessarily true of a C union. You might be able to > adapt the list example in > polyml/mlsource/extra/CInterface/Examples/ForeignTest.sml. The type in > C isn't exactly a union but you could have different STRUCTn for each > variant. > > I feel sure someone has a better example. > > Regards, > David > > On 20/08/2012 07:51, Pierre-Alain Bourdil wrote: > > Hi, > > > > i'm looking for an easy way to map CType union. By easy way i mean, > > either a Conversion or a make_union/break_union. Having a look at > > the source code of CInterface, i see that conversion are managed by a > > union signature so i guess there's a way. But is there a solution > > that already exists ? > > > > > > Regards, Pierre-Alain > > _______________________________________________ polyml mailing list > > [email protected] > > http://lists.inf.ed.ac.uk/mailman/listinfo/polyml > > _______________________________________________ polyml mailing list [email protected] http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
