Le 14/09/2011 18:56, Stéphane Glondu a écrit :
On 09/14/2011 06:42 PM, Romain Bardou wrote:
Thanks, this solves the "native" part of my problem ! Now I need to
figure out how to link this .so file.
You mean, the equivalent of dllmylib.so? There is no such file in native
code: mylib.cmxs will contain the contents of mylib.cmxa and wrapper.o.
No I mean the driver DLL for which Mylib is the binding. File
dllmylib.so is linked correctly, but binding.c includes api.h, which is
implemented in api.so, so I need to link with api.so as well. The whole
point of my original question is: how can I design the program such that
this api.so is loaded dynamically, because the user may want to choose a
different driver everytime, or even change driver during execution.
That would be a -cclib option passed to ocamlmklib. It embeds a -lXXX
option in the .cmxa that should be visible with a recent version of
ocamlobjinfo. You can check the result by running ldd on the .cmxs file.
Cheers,
Thanks, I tried the following combinations (with the bytecode version,
not the native one):
-cclib -l$(DLLPATH)$(DLLNAME)$(DLLEXT)
-cclib -L$(DLLPATH) -cclib -l$(DLLNAME)$(DLLEXT)
-L$(DLLPATH) -cclib -l$(DLLNAME)$(DLLEXT)
-cclib -l$(DLLPATH)$(DLLNAME)
-cclib -L$(DLLPATH) -cclib -l$(DLLNAME)
-L$(DLLPATH) -cclib -l$(DLLNAME)
Where $(DLLPATH) is the full path to my driver, such as /usr/lib/,
$(DLLNAME) is driver file name without the extension, such as driver,
and $(DLLEXT) is the extension, such as .so, such that the full .so path
is /usr/lib/driver.so.
None of them works; I still get the "undefined symbol" error. The option
does appear with ocamlobjinfo though. For instance, here is the result
of ocamlobjinfo on the .cma using the last command:
Extra C object files: -lcryptoki -ldriver
Extra C options: -L/usr/lib/
Extra dynamically-loaded libraries: -lcryptoki
Shouldn't the -ldriver option appear in the extra dynamically-loaded
libraries as well?
I might try Jeremie's more direct approach if everything else fails.
Cheers,
--
Romain Bardou
--
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