* how to call an OCaml library from C/C++ ?
@ 2010-08-24 17:50 Yoann Padioleau
2010-08-24 18:22 ` [Caml-list] " Yoann Padioleau
0 siblings, 1 reply; 2+ messages in thread
From: Yoann Padioleau @ 2010-08-24 17:50 UTC (permalink / raw)
To: caml users
Hi,
Is there a way to call OCaml library from a C/C++ program without the C++ program
knowing it's OCaml code ? I mean I can not touch the main of the C++ program
so it has to be completely transparent and it would be good if each call to the ocaml library
once finished free all the memory it was using.
Can we call caml_startup() multiple times ? is there a caml_cleanup ?
Ideally I would like from C/C++ to have:
my_extension.c:
char* sanitize_stuff(char *s) {
caml_startup();
char * res = <call_ocaml_code_with_s>;
caml_cleanup();
return res;
}
and then link my c++ program with my_extension.o and some .a containing ocaml code.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] how to call an OCaml library from C/C++ ?
2010-08-24 17:50 how to call an OCaml library from C/C++ ? Yoann Padioleau
@ 2010-08-24 18:22 ` Yoann Padioleau
0 siblings, 0 replies; 2+ messages in thread
From: Yoann Padioleau @ 2010-08-24 18:22 UTC (permalink / raw)
To: Yoann Padioleau; +Cc: caml users
On Aug 24, 2010, at 10:50 AM, Yoann Padioleau wrote:
>
> Hi,
>
> Is there a way to call OCaml library from a C/C++ program without the C++ program
> knowing it's OCaml code ? I mean I can not touch the main of the C++ program
> so it has to be completely transparent and it would be good if each call to the ocaml library
> once finished free all the memory it was using.
> Can we call caml_startup() multiple times ? is there a caml_cleanup ?
>
> Ideally I would like from C/C++ to have:
>
>
> my_extension.c:
> char* sanitize_stuff(char *s) {
>
> caml_startup();
> char * res = <call_ocaml_code_with_s>;
> caml_cleanup();
> return res;
> }
Also it is possible to have multiple independent ocaml runtime at the same time
so such a function is thread-safe ?
>
> and then link my c++ program with my_extension.o and some .a containing ocaml code.
>
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-24 18:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24 17:50 how to call an OCaml library from C/C++ ? Yoann Padioleau
2010-08-24 18:22 ` [Caml-list] " Yoann Padioleau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox