If I compile following you suggestion I got the following error
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
U:\docs\OA\articles\zlib\kbhook\kbhook.dll: The specified path is invalid

If I replace the newly compiled dll with the old one (compiled for java 32 bit) 
I got
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
U:\docs\OA\articles\zlib\kbhook\kbhook.dll: Can't load IA 32-bit .dll on a AMD 
64-bit platform

So, I think it's a problem with the dll, not the path of it.

Francois

-----Original Message-----
From: Kai Tietz [mailto:[email protected]] 
Sent: mardi, 20. septembre 2011 09:15
To: [email protected]
Subject: Re: [Mingw-w64-public] Compiling a dll for JNI and java 64 bits

2011/9/20 RAPPAZ Francois <[email protected]>:
> Yes, that does not work, on W7, to have a dll usable with java 64 bits:
>  jdk='/cygdrive/c/Program Files/Java/Jdk1.7.0'
> x86_64-w64-mingw32-g++ -w  -mno-cygwin -I"$jdk/include" 
> -I"$jdk/include/win32" -Wl,--add-stdcall-alias -shared -o kbhook.dll 
> kbhook.cpp
>
> It does produce a file without error message, but the java VM complains that 
> it can't use it.
>
> On Windows XP these compilation was ok
>  jdk='/cygdrive/c/Program Files/Java/Jdk1.6.0_24'
>  g++ -w -mno-cygwin -I"$jdk/include" -I"$jdk/include/win32" 
> -Wl,--add-stdcall-alias -shared -o kbhook.dll kbhook.cpp
>
> Francois
>
>
>
>
> -----Original Message-----
> From: NightStrike [mailto:[email protected]]
> Sent: lundi, 19. septembre 2011 15:46
> To: [email protected]; RAPPAZ Francois; Kai Tietz
> Subject: Re: [Mingw-w64-public] Compiling a dll for JNI and java 64 
> bits
>
> Still having problems?
>
> On Fri, Sep 16, 2011 at 4:31 AM, RAPPAZ Francois <[email protected]> 
> wrote:
>> Kay,
>>
>> Yes I was meaning Windows 7 sorry.
>>
>> >From the control panel, system, I see that I have Windows 7 Enterprise, 64 
>> >Bit operating system.
>>
>> Francois
>>
>>
>> -----Original Message-----
>> From: Kai Tietz [mailto:[email protected]]
>> Sent: vendredi, 16. septembre 2011 10:15
>> To: [email protected]
>> Subject: Re: [Mingw-w64-public] Compiling a dll for JNI and java 64 
>> bits
>>
>> 2011/9/16 RAPPAZ Francois <[email protected]>:
>>> I have a application that use a dll with Java native interface. 
>>> Under windows XP, using Cygwin, that 2 lines
>>>
>>> jdk='/cygdrive/c/Program Files/Java/Jdk1.6.0_24'
>>> g++ -w -mno-cygwin -I"$jdk/include" -I"$jdk/include/win32"
>>> g++ -Wl,--add-stdcall-alias -shared -o kbhook.dll kbhook.cpp
>>>
>>> gaved a 27 KB kbhook.dll, that was ok.
>>>
>>> I'm not with Windows 6 and I need to recompile my code to have a 
>>> 64Bit dll, and I tried this
>>>
>>> jdk='/cygdrive/c/Program Files/Java/Jdk1.7.0'
>>> x86_64-w64-mingw32-g++ -w  -mno-cygwin -I"$jdk/include"
>>> -I"$jdk/include/win32" -Wl,--add-stdcall-alias -shared -o kbhook.dll 
>>> kbhook.cpp
>>>
>>> which produced a kbhook.dll file which is 118 kB
>>>
>>> Unfortunatly I still get an error
>>> Exception in thread "main" java.lang.UnsatisfiedLinkError: 
>>> U:\docs\OA\articles\zlib\kbhook\kbhook.dll: The specified path is invalid.
>>> java -v says java version "1.7.0" Java(TM) SE Runtime Environment 
>>> (build 1.7.0-b147) Java HotSpot(TM) 64-Bit Server VM (build 
>>> 21.0-b17, mixed mode)
>>>
>>> Does anyone have a clue on this ?
>>> Thanks
>>>
>>> François
>>
>> Hello François,
>>
>> first what you mean by Windows 6?  You mean Windows 7, right?
>> Second question, do you use a 64-bit windows to execute, or are you working 
>> on a 32-bit one?
>>
>> Regards,
>> Kai

Hmm, the only option which looks suspious to me is '-Wl,--add-stdcall-alias'.  
This makes for x64 no sense, as x64 abi doesn't have @ decoration for 
stdcall/fastcall.  So does it make a difference, when you are removing it?

Regards,
Kai

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a 
definitive record of customers, application performance, security threats, 
fraudulent activity and more. Splunk takes this data and makes sense of it. 
Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to