Le mercredi 14 septembre 2011 à 17:00 +0200, Romain Bardou a écrit : 
> Hello Caml-List,
> 
> I need to write a program which handles several devices. Each device has 
> a .so (linux) or .dll (windows) driver. Each of these DLL share the same 
> API, defined in C headers (api.h).
> 
> Here is what I figured I should do.
> - Write a binding for the library.
>    * OCaml part: mylib.ml, with externals.
>    * C part: wrapper.c, implementing the externals.
>      - Which itself includes api.h and may use the functions of the API.
> - Dynamically load this library using Dynlink.
> Later, the Mylib module will register each function of the API so the 
> program can call them, but that's not the issue (although if there is a 
> simpler way please tell).

You can also use dlopen and dlsym on unix, and 
LoadLibrary and GetProcAddress on windows.

-- 
Jérémie



-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to