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
How to call OCaml from C++
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-02-23 (03:11)
From: Jianzhou Zhao <jianzhou@s...>
Subject: How to call OCaml from C++

Does anyone call OCaml code from C++?
C can call OCaml with the OCaml foreign interfaces.
But when we call OCaml from C++, we need to consider ‘extern C'
stuff, like what we do when call C from C++, because the bridge
functions between C and OCaml are written in C.

However, those functions have not been prefixed with 'extern C',
and some functions, such as caml_alloc_dummy in libasmrun, have not
been exposed
in a head file. So it is hard to define a wrapper to let it work in C++.
When linking C++ and libasmrun, caml_alloc_dummy cannot
be found by the linker.

Does anyone happen to know how to solve this problem?

Thanks a lot.