Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Shared libraries with ocamlopt callable from C (without main())?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-09 (08:21)
From: Matthieu Dubuget <matthieu.dubuget@g...>
Subject: Re: [Caml-list] Shared libraries with ocamlopt callable from C (without main())?
Ben Aurel a écrit :
> I'm thinking about the possibility to use OCaml as an extension
> language. If I wanted to call a OCaml function from langX I had to use
> a C wrapper.
>     langX -> ( C API of langX | C Wrapper | C API of OCaml ) -> OCaml


> But could somebody tell me if ( and maybe how ) this can be done. I made some attempts, but
> there is always a main() function involved. But this C wrapper would be a shared library.

Exactly. You can deliver your OCaml code as shared library, and then
call it from
any language that can call a shared library.

Could you point out what problem you faced?