3
Vote

Makefile with 64 bit support

description

Unless having knowledge about JNI, C++ and Java, then it can be difficult to setup Microsoft SDK properly.
 
To setup an environment for compiling the DLL:
 
1) Install Microsoft Vista SDK and ensure that x64 compiler and library is selected (Unselect documentation and samples)
  • Have tried using Win2008 SDK and Win7 SDK but the SetEnv.cmd is faulty (Fails to set LIB-path and PATH environment variables properly)
    2) Install Sun JDK (I used Sun JDK 1.6 14)
    3) Modify the makefile so it points to SDK and JDK
    JAVADIR = "C:\Program Files\Java\jdk1.6.0_14"
    VC = "C:\Program Files\Microsoft SDKs\Windows\v6.0\VC"
    PSDKDIR = "C:\Program Files\Microsoft SDKs\Windows\v6.0"
     
    To compile the 32 bit dll:
    1) Open a command prompt
    2) Setup the VC environment by running this command
    "C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\SetEnv.Cmd" /Release /x86 /xp
    3) Go to the Msmqjava source code (where the makefile resides), and run this command
    nmake
     
    To compile a 64 bit dll, then we need to modify the makefile, so it becomes aware of what environment we are targetting. I have attached a makefile, that checks the environment variable CPU and sets the compiler and library accordinly. Use this makefile instead of the one supplied with MsmqJava.
     
    To compile the 64 bit dll (After having updated to the new makefile):
    1) Open a command prompt
    2) Setup the VC environment by running this command (Notice x64)
    "C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\SetEnv.Cmd" /Release /x64 /xp
    3) Go to the Msmqjava source code (where the makefile resides), and run this command
    nmake

file attachments

comments

snakefoot wrote Aug 25, 2009 at 4:49 PM

Btw. I have modifed the compiler options in the attached makefile, so it compiles with static libraries, so one avoids the need to deploy extra Microsoft DLLs. http://blogs.msdn.com/aymans/archive/2006/04/04/568466.aspx

snakefoot wrote Aug 27, 2009 at 9:24 AM

Seems the reason why SetEnv.cmd on Win2008/Win7 SDK is not working is because it should either be launched with some extra parameters to properly execute SetEnv.cmd:

cmd.exe /E:ON /V:ON

The same parameters are used when using the shortcuts in the Start Menu created by the SDKs

mnuni wrote Feb 15, 2010 at 8:38 PM

Hi, I tried the above (using cmd.exe /E:ON /V:ON) and that worked using SDK for Win2008. i.e. nmake produced no errors. However there is no JNIMSMQ.dll created as part of the build. I'm new to nmake and .NET and need a 64 bit version of the dll to call from a 64bit JVM. Which part of the makefile produces the dll? Would anyone have a 64bit dll that they could share? Many thanks.

jbaruch wrote Jun 9, 2010 at 7:25 PM

Guys, for the c++ illiterates like me, can you please share the dll itself?

wrote Jun 10, 2010 at 1:53 PM

wrote Mar 21, 2011 at 4:19 AM

wrote Feb 14, 2013 at 3:35 AM

wrote Jul 25, 2015 at 5:03 AM

defiestc wrote Jul 25, 2015 at 5:03 AM

Updated makefile and 64-bit DLLs attached.

defiestc wrote Jul 25, 2015 at 5:18 AM

I tried using the attached makefile, but it did not create the msmqjava.h file. So, I modified the original makefile and path'd to the x64 and amd64 directories.

Here's my steps:

I have VS 2010 Ultimate installed on my Win7 64-bit box.

I downloaded the Java SE Development Kit 7 for Windows x64 version and installed it choosing the default settings.

I also downloaded the Microsoft Windows SDK for Windows 7 and .NET Framework 4 and installed it.

Then, I modified the makefile by updating the paths and was able to build.

I had to use DOS paths in the makefile. See http://stackoverflow.com/questions/4051088/how-to-get-dos-path-instead-of-windows-path on how to get the DOS paths.

Also, to check if the DLLs were 64-bit, I used dumpbin /headers msmqjava.dll from the VS Command Prompt x64.

The command I used in the VS Command Prompt x64 was:

nmake CONFIG=Release

I have not tested the DLL; however, I leave that up to you. May the Force be with you!

Mahalo,
Clarence D.