lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Imre András <ia...@freemail.hu>
Subject Re: Unresolved external symbol errors when linking example native c++ code that uses jcc
Date Fri, 22 Oct 2010 10:41:07 GMT
Hi,

Ok, thanks. After resolving this I got the following error:
jcc.cpp(294) : error C2039: 'fromJString' : is not a member of 'JCCEnv'

As I see this method is present in JCCEnv.h, but an #ifdef PYTHON directive prevents to make
it available for the tier code I intended to write which would have been based on the jcc
generated stub.



I am evaluating JNI wrappers. Our dev team need a layer that would ease calling java code
from native code. It also must have a clear and documented interface, and should work with
a trivial minimal example (Only one class, contains a static and a normal method.)

No offense, but my opinion is that jcc is nice stuff, and surely makes available Lucene for
Python developers, but in its current state it seems to be not suited for such a general-purpose
JNI wrapper. Integration should be staright, easy and straightforward, no matter what IDE
or compiler used.

I would suggest to go for setting up a minimal non-Python example that demonstrates an example
C++ code which calls java - in a clear and separate environment (simulating the end user's).
This will surely bring up the issues - some of them I have tackled, but unfortunately I ran
out of time...


Thanks for the help. jcc will be on my watch list :)

Best regards,
  András


Andi Vajda <vajda@apache.org> írta:
>>
On Thu, 21 Oct 2010, Imre András wrote:>
>
> JCCEnv.h has the following:>
>>
> ...>
> #ifdef _jcc_shared>
> _DLL_IMPORT extern JCCEnv *env;>
> _DLL_IMPORT extern DWORD VM_ENV;>
> #else>
> _DLL_EXPORT extern JCCEnv *env;>
> _DLL_EXPORT extern DWORD VM_ENV;>
> #endif>
> ...>
>>
> I suspect here is the root of my linker problem. Where should this *env >
> get resolved?>
>
These are in JCCEnv.cpp and jcc.cpp which gets linked with your shared >
library either dynamically (when using --shared) or statically.>
>
You need to link a piece of jcc itself with your code. To get an example >
link line, ask jcc to create a python extension for you, a correct link line >
flies by.>
>
Andi..>
>
>>
>>
> Thanks,>
>  András>
>>
>>
> "Imre András" <iar73@freemail.hu> írta:>
>> Hi list,>>
>>>
> I intend to use jcc to ease calling Java code from native code. I managed to build and
install it. Now I try to build my first test code from within MS VS 2010 Win32 console app
project. Despite setting up the libs and includes I still get linker errors:>>
>>>
> ------------------------------------------------------------------>>
> Link:>>
> C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.exe"
/INCREMENTAL /NOLOGO python27.lib _jcc.lib jvm.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Debug\jcc.exe.intermediate.manifest"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.pdb"
/SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.lib"
/MACHINE:X86 Debug\jcc.exe.embed.manifest.res>>
> Debug\jcc.obj>>
> Debug\stdafx.obj>>
> Debug\__wrap__.obj>>
> Creating library C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.lib and object
C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.exp>>
> 1>jcc.obj : error LNK2001: unresolved external symbol "unsigned long VM_ENV" (?VM_ENV@@3KA)>>
> 1>stdafx.obj : error LNK2001: unresolved external symbol "unsigned long VM_ENV" (?VM_ENV@@3KA)>>
> 1>__wrap__.obj : error LNK2001: unresolved external symbol "unsigned long VM_ENV"
(?VM_ENV@@3KA)>>
> 1>jcc.obj : error LNK2001: unresolved external symbol "class JCCEnv * env" (?env@@3PAVJCCEnv@@A)>>
> 1>stdafx.obj : error LNK2001: unresolved external symbol "class JCCEnv * env" (?env@@3PAVJCCEnv@@A)>>
> 1>__wrap__.obj : error LNK2001: unresolved external symbol "class JCCEnv * env" (?env@@3PAVJCCEnv@@A)>>
> 1>C:\out\app\PeldaProgram\ZipBe\bin\test\src\Debug\jcc.exe : fatal error LNK1120:
2 unresolved externals>>
> 1>Done Building Project "C:\out\app\PeldaProgram\ZipBe\bin\test\jcc\jcc.vcxproj" (rebuild
target(s)) -- FAILED.>>
>>>
> Build FAILED.>>
>>>
> Time Elapsed 00:00:12.60>>
> ------------------------------------------------------------------>>
>>>
>>>
> jni.h and Native2Java.h (jcc generated from the java class I intend to use in native
c++ code) is added to stdafx.h. Now I have no idea where the above symbols come from, and
how should I resolve them.>>
>>>
>>>
> Regards,>>
> András>>
>>>
>>
>

Mime
View raw message