caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* dynamic link library path under mingw
@ 2010-01-27 13:56 Matthieu Dubuget
  2010-01-27 16:17 ` [Caml-list] " Xavier Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: Matthieu Dubuget @ 2010-01-27 13:56 UTC (permalink / raw)
  To: caml-list

Hello,

I'm doing something wrong, but can't figure out what?

***********************************
Library compilation, in libeeproms/:

This is a mixed ocaml/c library,
and it depends on a third party DLL
***********************************


$ ocamlc -c eprom_stubs.c
$ ocamlmklib -o m2mEeproms eprom_stubs.o eprom.mli \
   eprom.ml EpromDll.dll

***********************************
Bytecode program compilation, in tests/:
***********************************

$ cd ../tests
$ ocamlc -I c:/cygwin/home/matt/m2m/m2m-ml/libeeproms \
          -I c:/cygwin/home/matt/ocamlmgw/lib/site-lib/oUnit \
          unix.cma oUnit.cma m2mEeproms.cma test_eprom.ml tests.ml
$ ./tests.byte
Fatal error: cannot load shared library dllm2mEeproms
Reason: Le module spécifié est introuvable.


Mmm. Ok! I have to help ocamlrun:

$ ocamlrun -I c:/cygwin/home/matt/m2m/m2m-ml/libeeproms tests.byte
Fatal error: cannot load shared library dllm2mEeproms
Reason: Le module spécifié est introuvable.

Maybe with CAML_LD_LIBRARY_PATH?

$ CAML_LD_LIBRARY_PATH=c:/cygwin/home/matt/m2m/m2m-ml/libeeproms 
./tests.byte
Fatal error: cannot load shared library dllm2mEeproms
Reason: Le module spécifié est introuvable.

In fact, the only way I found is to modify the system dynamic loader 
searched paths (I tried ld.conf, -dllpath…):

$ PATH="/home/matt/m2m/m2m-ml/libeeproms:$PATH" ./tests.byte
Eprom:0:EpromDll.dll revision ... ok

Is this a bug, at least in the documentation ?

$ ocamlc -version
3.11.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] dynamic link library path under mingw
  2010-01-27 13:56 dynamic link library path under mingw Matthieu Dubuget
@ 2010-01-27 16:17 ` Xavier Leroy
  2010-01-27 17:06   ` Matthieu Dubuget
  0 siblings, 1 reply; 4+ messages in thread
From: Xavier Leroy @ 2010-01-27 16:17 UTC (permalink / raw)
  To: matthieu.dubuget; +Cc: caml-list

> I'm doing something wrong, but can't figure out what?

Try setting the OCAMLRUNPARAMS environment variable to the value "v=256".
The run-time system will then print additional debug messages
concerning DLL searching and loading.

- Xavier Leroy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] dynamic link library path under mingw
  2010-01-27 16:17 ` [Caml-list] " Xavier Leroy
@ 2010-01-27 17:06   ` Matthieu Dubuget
  2010-01-27 17:20     ` Matthieu Dubuget
  0 siblings, 1 reply; 4+ messages in thread
From: Matthieu Dubuget @ 2010-01-27 17:06 UTC (permalink / raw)
  To: caml-list


From: Xavier Leroy <Xavier.Leroy@inria.fr>
>>
>> Try setting the OCAMLRUNPARAMS environment variable to the value "v=256".
>> The run-time system will then print additional debug messages
>> concerning DLL searching and loading.
>>
>> - Xavier Leroy


OCAMLRUNPARAM without S!

Thanks for the tip.

> $ OCAMLRUNPARAM="v=256" ./tests.byte
> Opening bytecode executable C:\cygwin\home\matt\m2m\m2m-ml\tests\tests.byte
> Searching C:/cygwin/home/matt/ocamlmgw/lib/stublibs\dllunix.dll
> Loading shared library C:/cygwin/home/matt/ocamlmgw/lib/stublibs\dllunix.dll
> Dynamic symbol at 10009000 (size = 205)
> [0]  100011F8: FlexDLLiniter@12
> [1]  100068C0: WSACleanup@0
> [2]  100068B8: WSAEventSelect@12
> .
> .
> .
> Searching C:/cygwin/home/matt/ocamlmgw/lib/stublibs\dllm2mEeproms.dll
> Searching C:/cygwin/home/matt/ocamlmgw/lib/site-lib/stublibs\dllm2mEeproms.dll
> Searching C:/cygwin/home/matt/ocamlmgw/lib\dllm2mEeproms.dll
> dllm2mEeproms.dll not found in search path
> Loading shared library dllm2mEeproms.dll
> Fatal error: cannot load shared library dllm2mEeproms
> Reason: Le module sp?cifi? est introuvable.

OK. only the paths stored in ld.conf are tried. Testing -I.

> $ OCAMLRUNPARAM="v=256" ocamlrun -I ../libeeproms ./tests.byte
> Opening bytecode executable C:\cygwin\home\matt\ocamlmgw\bin\ocamlrun.exe
> Not a bytecode executable
> Opening bytecode executable C:\cygwin\home\matt\m2m\m2m-ml\tests\tests.byte
> Searching ../libeeproms\dllunix.dll
> Searching C:/cygwin/home/matt/ocamlmgw/lib/stublibs\dllunix.dll
> Loading shared library C:/cygwin/home/matt/ocamlmgw/lib/stublibs\dllunix.dll
> Dynamic symbol at 10009000 (size = 205)
> [0]  100011F8: FlexDLLiniter@12
> [1]  100068C0: WSACleanup@0
> [2]  100068B8: WSAEventSelect@12
> [3]  100068B0: WSAGetLastError@0
> .
> .
> .
> [203]  10005879: worker_push
> [204]  10005438: worker_wait@4
> Searching ../libeeproms\
> Loading shared library ../libeeproms\dllm2mEeproms.dll
> Fatal error: cannot load shared library dllm2mEeproms
> Reason: Le module spécifié est introuvable.


This is better:  was found, but can't be loaded?

Maybe because it depends on another library?

depends.exe allow to check that  needs .

> [   ] DLLM2MEEPROMS.DLL
>      [   ] KERNEL32.DLL
>           [   ] NTDLL.DLL
>      [   ] MSVCRT.DLL
>           [ ^ ] KERNEL32.DLL
>                [F^ ] NTDLL.DLL
>           [ ^ ] NTDLL.DLL
>      [   ] EPROMDLL.DLL
>           [ ^ ] KERNEL32.DLL
>                [F^ ] NTDLL.DLL
>

I have the feeling that dllm2mEeproms.dll is loaded explicitely,
but that the load of EpromDll.dll is left to the operating system?


The following works:

If dllm2mEeproms.dll and EpromDll.dll are both in ../libeeproms:
> PATH="../libeeproms:$PATH" OCAMLRUNPARAM="v=256" ocamlrun -I ../libeeproms ./tests.byte


If I move EpromDll.dll in ../libeeproms/toto:
> PATH="../libeeproms/toto:$PATH" ocamlrun -I "../libeeproms" tests.byte


Two separated problems, then:
- how to store a search path into tests.byte?
- is it possible to have EpromDll.dll loaded, even if not in a $PATH 
directory?

Salutations



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] dynamic link library path under mingw
  2010-01-27 17:06   ` Matthieu Dubuget
@ 2010-01-27 17:20     ` Matthieu Dubuget
  0 siblings, 0 replies; 4+ messages in thread
From: Matthieu Dubuget @ 2010-01-27 17:20 UTC (permalink / raw)
  To: caml-list

Matthieu Dubuget:
> Two separated problems, then:
> - how to store a search path into tests.byte?

The use of -dllpath when generating tests.byte does it. I wanted to
add this path during library generation, not when using it.

Anyway. This is not the biggest problem: I will use ocamlfind, that 
maintains ld.conf, and allows to solve this problem.

> - is it possible to have EpromDll.dll loaded, even if not in a $PATH
> directory?
>
> Salutations
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-27 17:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-27 13:56 dynamic link library path under mingw Matthieu Dubuget
2010-01-27 16:17 ` [Caml-list] " Xavier Leroy
2010-01-27 17:06   ` Matthieu Dubuget
2010-01-27 17:20     ` Matthieu Dubuget

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).