[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [LuaJIT] ffi.load on Cygwin
- From: Patrick Rapin <toupie300@...>
- Date: Sat, 17 Mar 2012 02:22:43 +0100
>> So to support that platform, CLIB_SOEXT must me defined to ".dll", and
>> the test for the "lib" prefix must be adapted to the "cyg" prefix.
>
> But that'd foil any attempt to load (true) Windows DLLs, no?
> And I bet most programs ported to Cygwin have to use a mixture of
> POSIX and Windows functionality.
Yes indeed. If "cyg" prefix is automatically added, you couldn't load
system libraries like ffi.load"kernel32" because ffi.load would look
for cygkernel32.dll.
This is not a regression however as currently this does not work
neither: ffi.load now searches for libkernel32.so...
Only these two forms are working :
ffi.load 'c:/windows/system32/kernel32.dll'
ffi.load '/cygdrive/c/windows/system32/kernel32.dll'
I think we can resolve the problem by changing a little bit the logic :
- If the parameter has neither a path nor an extension, transform it
to cygXXX.dll :
ffi.load "png" => looks for cygpng.dll
- If the filename has either an extension or a path, pass it verbatim
to dlopen :
ffi,load "kernel32.dll" => finds kernel32.dll in c:\windows\system32
ffi.load "./my_lib" => looks for my_lib in current directory
This makes sense IMHO since the first form is typical in a POSIX
platform while the second would be expected on a Windows one.
> Anyway, Cygwin is a mess. MinGW works just fine and is almost
> always the better choice. Ok, so I'll take a tested patch, but
> only if it doesn't cause any other regressions.
Well I do like Cygwin: it has both the power of POSIX and Windows...
MinGW works great, true, but does not come with all the GNU software
distribution !
Anyway, thanks for trying a patch.