[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Emir Pasalic <pasalic@c...> |
| Subject: | Dynamic linking |
We are writing a program that generates a C file, compiles it to a
dynamic library, and uses dlopen (and such) to load it, execute it and
bring its value into ocaml (bytecode) runtime. To do this, we need to
use some of the functionality of the ocaml runtime (e.g., caml_alloc,
caml_update) so we can marshall values from the C world into the world
of ocaml. Our solution works on linux and macos platforms, but we have
a problem trying to make it run on windows with Cygwin.
So, we're trying to create a shared library on Cygwin that contains
symbols such as "caml_alloc" and "caml_update".
We do not know of a way to easily incorporate these symbols in the
linking process, and so they
remain undefined when we try to create a library, and undefined symbols
are not allowed in Cygwin shared libraries.
Therefore we tried to resort to another method, where the calls to
caml_alloc and caml_update are replaced by
calls to dlopen and dlsym functions, i.e., we were trying to do this:
h = dlopen ("<the library name>", RLTD_NOW);
/* process error */
s = dlsym (h, "caml_alloc");
/* process error */
my_alloc = /* proper casting */ s;
result = my_alloc ( /* arguments */ );
Assuming that this is possible, what is the name that should be given
to the library?
Else, is it possible to build a shared library on Cygwin that contains
references to these symbols?
Note that all this works perfectly fine on MacOS and linux which allow
unresolved symbols in dynamic libraries, but Cygwin simply dies. Any
Windows/Cygwin experts out there who can help us?