dlopen on Windows

1,874 views
Skip to first unread message

J Luis

unread,
May 30, 2012, 3:24:53 PM5/30/12
to juli...@googlegroups.com
Hi,

Is dlopen supposed to work on Windows?

I keep getting errors of the type below.

julia> lili=dlopen("c:/SVN/mironeWC/zlib1_w32.dll")
could not load module c:/SVN/mironeWC/zlib1_w32.dll (-1): The specified module could not be found.

Note that in this case I picked one dll (zlib) that doesn't depend on any other external dll

Joaquim

Keno Fischer

unread,
May 30, 2012, 3:47:06 PM5/30/12
to juli...@googlegroups.com

J Luis

unread,
May 30, 2012, 3:59:37 PM5/30/12
to juli...@googlegroups.com


Quarta-feira, 30 de Maio de 2012 20:47:06 UTC+1, Keno Fischer escreveu:
Should work now: https://github.com/loladiro/julia/commit/67dd542d3be99d968216147a9b168a1b7f6fa283


Keno, I'm afraid it won't (though I didn't try yet due to the long build time) 
I had already tried with the variation around the unix vs windows path names. 

julia> lili=dlopen("/c/SVN/mironeWC/zlib1_w32.dll")
could not load module /c/SVN/mironeWC/zlib1_w32.dll (-1): The specified module could not be found.

And even if I copy the dll to the julia's root dir I still get the same error  

julia> lili=dlopen("zlib1_w32.dll")
could not load module zlib1_w32.dll (-1): The specified module could not be found.

but I'm puzzled with the meaning of the error message, I get exactly the same one if try to open a non existing file

julia> lili=dlopen("zlib1_w32_.dll")
could not load module zlib1_w32_.dll (-1): The specified module could not be found.

Something else is going on?

Joaquim

Keno Fischer

unread,
May 30, 2012, 4:04:30 PM5/30/12
to juli...@googlegroups.com
I'm not support MINGW style path names on windows. What should work now is dlopen("C:\\SVN\\mironeWC\\zlib1_w32.dll") and propbably even dlopen("C:/SVN/mironeWC/zlib1_w32.dll"). To load a file within the search path you have to omit the file ending, so if your dll is in the search path, you should just do dlopen("zlib1_w32") (that is for platform compatibility).

J Luis

unread,
May 30, 2012, 4:18:00 PM5/30/12
to juli...@googlegroups.com
Ah, actually all of those forms work, ... as long as I don't add the 'dll' suffix, otherwise all cases error with the same error message


julia> dlopen("zlib1_w32")
Ptr{Void} @0x03308be0

julia> dlopen("C:/SVN/mironeWC/zlib1_w32")
Ptr{Void} @0x03308be0

julia> dlopen("C:\\SVN\\mironeWC\\zlib1_w32")
Ptr{Void} @0x03308ce0

The reason why I'm running on the msys shell is because my build was probably incomplete (or some other cause) and some dlls were note generated. 
For instance, julia.exe depends on pthreadGC2.dll but I didn't get that dll built, but it runs from msys because it finds that pthread lib in the mingw path (didn't investigate this issue any deeper than this).

Jameson Nash

unread,
May 30, 2012, 7:50:48 PM5/30/12
to juli...@googlegroups.com
pthreadGC2.dll (and some others) are provided by mingw, not julia. You can manually add mingw folders to your windows path variable, or copy them locally (I modified the julia.bat script to do the former for my own testing -- PM me if you want it).

All other forms have the same error message because they are the same -- Julia dlopen couldn't find the file according to the typical (linux) rules for search.

-jameson

J Luis

unread,
May 30, 2012, 8:14:14 PM5/30/12
to juli...@googlegroups.com


Quinta-feira, 31 de Maio de 2012 0:50:48 UTC+1, Jameson escreveu:
pthreadGC2.dll (and some others) are provided by mingw, not julia. You can manually add mingw folders to your windows path variable, or copy them locally (I modified the julia.bat script to do the former for my own testing -- PM me if you want it).

Right. I thought it would be generated because my old install from the pre-compiled binaries came with one (which I copied but got new errors).

Thanks for the offer but I have a similar setup for other environments using Console2 (very handy for these type of things too) and it won't be difficult to extend to this case.

Joaquim
Reply all
Reply to author
Forward
0 new messages