[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [MirageOS-devel] C++ library to OCaml: OCaml objects
I am trying to use ctypes to convert a C++ library for use with OCaml. For the most part, I have had some success, but I'm struggling with using an OCaml Object as a representation for the C++ object: let value_id = object method get_command_class_id = foreign "GetCommandClassId" (void @-> returning int) end Above is the object that I would like to use. I feel that this is the easiest way to represent the ValueID in my OCaml code. Next, I wanted to set the type to work with the # notation that OCaml uses for objects. type value_id = < get_command_class_id : int > let value_id : value_id typ = ptr void With this, I am getting an error: Error: This expression has type unit ptr typ but an expression was expected of type value_id typ Type iunit ptr = (unit, [ `C ]) pointer is not compatible with type value_id = < get_command_class_id : int > Does anyone know how I can rectify this issue? My OCaml still isn't that strong, so any feedback is appreciated. Thanks, SteveThis message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |