Comments (8)
Function names are case sensitive.
On Apr 3, 2012, at 11:33 AM, write2warriors wrote:
Hi, I am getting the following error. Please help.
java.lang.UnsatisfiedLinkError: Error looking up function 'funcA': The specified procedure could not be found.Am I doing something wrong?
Using the Dependency Walker, it shows MY.DLL has the following dependency and functions:
MY.DLL has a dependency on Kernel32.DLL. Kernel32.DLL has a dependency on NTDLL.DLL
functions:
class SomeClass & SomeClass::operator=(class SomeClass const &)
void FuncA(unsigned short,unsigned char *,unsigned char *)
int FuncB(unsigned char *,unsigned char *)My JNA interface:
public interface MyDll extends Library {
void funcA(short len, char[] input, char[] output);
int funcB(char[] input, char[] output);
}Calling:
char[] input = new char[] { [char array initialization] };
char[] output = new char[8]; // output has no more than 8 charactersMyDll myDll = (MyDll) Native.loadLibrary("C:[some path]\my.dll", My.class);
myDll.ecrMac(input, output);The library is loaded, but why am I getting the error
java.lang.UnsatisfiedLinkError: Error looking up function 'funcA': The specified procedure could not be found.
Reply to this email directly or view it on GitHub:
#65
from jna.
It was a typo in this report. The function names are the same as the ones shown in Dependency Walker
from jna.
let me retype this. I apologize for the typo.
Using the Dependency Walker, it shows MY.DLL has the following dependency and functions:
MY.DLL has a dependency on Kernel32.DLL. Kernel32.DLL has a dependency on NTDLL.DLL
functions:
class SomeClass & SomeClass::operator=(class SomeClass const &)
void FuncA(unsigned short,unsigned char *,unsigned char *)
int FuncB(unsigned char *,unsigned char *)
My JNA interface:
public interface MyDll extends Library {
void FuncA(short len, char[] input, char[] output);
int FuncB(char[] input, char[] output);
}
Calling:
char[] input = new char[] { [char array initialization] };
char[] output = new char[8]; // output has no more than 8 characters
MyDll myDll = (MyDll) Native.loadLibrary("C:[some path]\my.dll", My.class);
myDll.FuncB(input, output);
The library is loaded, but why am I getting the error
java.lang.UnsatisfiedLinkError: Error looking up function 'FuncA': The specified procedure could not be found.
Do I need to have an interface for the overloading operator=? It's something I don't need. If so, how?
from jna.
Does dependency walker show those function names exported exactly as "FuncA" and "FuncB"?
If you are using a C++ compiler, you must use 'extern "C"' in order to avoid name mangling; stdcall calling convention will also add a suffix to function names.
On Apr 3, 2012, at 7:04 PM, write2warriors wrote:
let me retype this. I apologize for the typo.
Using the Dependency Walker, it shows MY.DLL has the following dependency and functions:
MY.DLL has a dependency on Kernel32.DLL. Kernel32.DLL has a dependency on NTDLL.DLL
functions:
class SomeClass & SomeClass::operator=(class SomeClass const &)
void FuncA(unsigned short,unsigned char *,unsigned char *)
int FuncB(unsigned char *,unsigned char *)My JNA interface:
public interface MyDll extends Library {
void FuncA(short len, char[] input, char[] output);
int FuncB(char[] input, char[] output);
}Calling:
char[] input = new char[] { [char array initialization] };
char[] output = new char[8]; // output has no more than 8 charactersMyDll myDll = (MyDll) Native.loadLibrary("C:[some path]\my.dll", My.class);
myDll.FuncA(input, output);The library is loaded, but why am I getting the error
java.lang.UnsatisfiedLinkError: Error looking up function 'FuncA': The specified procedure could not be found.
Reply to this email directly or view it on GitHub:
#65 (comment)
from jna.
yes, dependency walker shows the following in the function column:
class SomeClass & SomeClass::operator=(class SomeClass const &)
void FuncA(unsigned short,unsigned char *,unsigned char *)
int FuncB(unsigned char *,unsigned char *)
Let me check with the one who wrote the DLL to see if they used 'extern "C"'.
Will update this as soon as I hear from them
from jna.
not sure if it answers your questions, but on Dedendency Walker,
Without undecorate C++ functions, it has:
??4SomeClass@@QAEAAV0@ABV0@@z
?FuncA@@YAXGPAE0@Z
?FuncB@@YAHPAE0@Z
With undecorate C++ functions, it has:
class SomeClass & SomeClass::operator=(class SomeClass const &)
void FuncA(unsigned short,unsigned char *,unsigned char *)
int FuncB(unsigned char *,unsigned char *)
I'm waiting for the DLL writer's reply, and will update this as soon as I hear from them.
from jna.
Update: The DLL is updated. now I am not getting the error anymore, but I am not getting any output.
dll exported function: int FuncB(unsigned char_, unsigned char_)
java: int FuncB (char[] input, char[] output).
code:
char[] output = new char[8]; // output has no more than 8 characters
char[] input = new char { 'x', 'x', 'x' };
int len = FuncB (input, output);
After FuncB is executed, output is just a blank char array, is it the DLL issue or I don't have the signature mapping correctly?
from jna.
Native unsigned char maps to java byte.
Java char maps to native wchar_t.
On Apr 13, 2012, at 6:45 PM, write2warriors wrote:
Update: The DLL is updated. now I am not getting the error anymore, but I am not getting any output.
dll exported function: int FuncB(unsigned char_, unsigned char_)
java: int FuncB (char[] input, char[] output).
code:
char[] output = new char[8]; // output has no more than 8 characters
char[] input = new char { 'x', 'x', 'x' };
int len = FuncB (input, output);After FuncB is executed, output is just a blank char array, is it the DLL issue or I don't have the signature mapping correctly?
Reply to this email directly or view it on GitHub:
#65 (comment)
from jna.
Related Issues (20)
- Unsafe increment of static field HOT 2
- Unsafe increment of mutable static field HOT 1
- Loading dll crashing + not up to date complation HOT 1
- IndexOutOfBoundsException in ELFSectionHeaders runnning on old IcedTea Java 8 version on ARMv7 HOT 7
- Monitor JNA's security posture with the Scorecard Action HOT 5
- Android Unable to load library from android-aarch64 HOT 1
- The free_callback function has a JNI weak global reference leak problem HOT 6
- loongarch64 need glibc2.36 HOT 29
- Consider adding M1 test on CI HOT 5
- Cannot run unsigned DLLs from user writeable PATH (windows) HOT 2
- Appveyor CI is broken HOT 3
- Enable RELRO HOT 4
- Collate License File Content HOT 1
- struct get different result with same code and process same data HOT 1
- JNA 7.0.0 Incompatible Native Library. HOT 1
- Segfault in jnadispatch.dll HOT 4
- Please provide a method for getting the NativeLibrary instance from Library interface
- Very heavy lock contention under load
- Loading jnidispatch on Android 15 with 16 KB page size leads to crash
- this ratted me pc pls help
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jna.