From: Andrea <mar...@go...> - 2009-02-24 19:25:18
|
Hi, I'm trying to use my C library in jython. There is already a working wrapper via JNI that works properly in Java. I'm using JDK 1.6.0_12 in Windows XP. C compiler VS 2005. Same behaviour in Jython 2.2.1 and 2.5b1 At some point I need to register my DLL and call System.load(). The problem is where I place the call to System.load(DllPath) (or the same loadLibrary) In Java I load it usually at the beginning. In jython I have 2 options 1) import java java.lang.System.load(DllPath) 2) import MyClass MyClass.init(DllPath) where init(String name) is a static method in MyClass: static void init(String name) { System.load(name); } In both cases the dll is loaded and DllMain called. So I do not have a problem of path. In the first case I get an exception whenever I call a native function from jython Exception in thread "main" java.lang.UnsatisfiedLinkError: MyClass.methodFoo(D)D and so on for each mathod. If I wrap the call to System.load so that it is called from Java, everything works. Is this the expected behaviour? Andrea |
From: Andrea <mar...@go...> - 2009-02-25 20:23:12
|
Andrea wrote: > Hi, > > I'm trying to use my C library in jython. > There is already a working wrapper via JNI that works properly in Java. > I'm using JDK 1.6.0_12 in Windows XP. C compiler VS 2005. > Same behaviour in Jython 2.2.1 and 2.5b1 > > At some point I need to register my DLL and call System.load(). > The problem is where I place the call to System.load(DllPath) (or the same loadLibrary) > I've seen it reported by other people, but unfortunately there was no answer: http://pylonshq.com/irclogs/%23jython/%23jython.2008-03-31.log.html#t2008-03-31T16:59:12 How do people load DLL with JNI code in Jython? |