Finally I compiled it. Main mistake was about VS enviromental variables. To compile and link proper I needed to type
%VisualStudoFolder%\VC\vcvarsall.bat amd64 nmake -f makefile
Default LuaJava distributions provides only 32-bit binaries. Obviously using them with 64-bit VM\OS causes exception.
Also I can't just change Lua binaries to 64-bit, because this causes
Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.keplerproject.luajava.LuaState._open()Lorg/keplerproject/luajava/CPtr;
I don't know why is it so and Google didn't help me.
I've decided it's because 64- and 32-bit libs are completely different, so I must recompile LuaJava and make linking myself.
I downloaded sources from Lua repo at SourceForge (luabinaries/files/5.1.4/Windows%20Libraries/) (btw I tried with different versions, but I have not succeeded), installed MSVS to use nmake
utility with Makefiles. Finally I followed guides from "LuaJava Manual" but I got only this:
...\luajava-1.1>nmake -f makefile
"
#Here was java-files compilation logs
#C compilation
cl -nologo -DWIN32 -I"C:\Program Files\Java\jdk1.7.0_21\/include" -I"C:\Program Files\Java\jdk1.7.0_21\/include/win32" -I"P:\Lua\include" -Fosrc\C\\ -MD /c src\c\luajava.c luajava.c
link /dll /nodefaultlib:"msvcrt.lib" -out:luajava-1.1.dll src\c\luajava.obj P:\Lua\lib\lua5.1.lib
Microsoft (R) Incremental Linker Version 12.00.20827.3
Copyright (C) Microsoft Corporation. All rights reserved.
Creating library luajava-1.1.lib and object luajava-1.1.exp
luajava.obj : error LNK2019: unresolved external symbol __imp____iob_func referenced in function _Java_org_keplerproject_luajava_LuaState_luajava_1open@16
luajava.obj : error LNK2019: unresolved external symbol __imp__fprintf referenced in function Java_org_keplerproject_luajava_LuaState_luajava_1open@16
luajava.obj : error LNK2019: unresolved external symbol __imp__exit referenced in function Java_org_keplerproject_luajava_LuaState_luajava_1open@16
luajava.obj : error LNK2001: unresolved external symbol "__fltused"
LINK : error LNK2001: unresolved external symbol "__DllMainCRTStartup@12"
luajava-1.1.dll : fatal error LNK1120: 5 unresolved externals
NMAKE : fatal error U1077: "P:\MS Visual Studio 2010\VC\BIN\link.EXE" : return code "0x460"
Stop.
Also here is luajava.h and luajava.c
So the question is how to resolve that problem (desirable so that it will work with at least LuaStateFactory.newLuaState().openLibs()
)?