Vinzz
Vinzz

Reputation: 4028

JNA call to C++ function with LPCWSTR parameters

I've done a C++ dll with a function which takes unicode strings (LPCWSTR type):

extern "C" __declspec( dllexport ) HRESULT signFile(LPCWSTR fileName, LPCWSTR certSubject, LPCWSTR storeName);

HRESULT signFile(LPCWSTR fileName, LPCWSTR certSubject, LPCWSTR storeName)

A colleague of mine is trying to call this through JNA

Using String as parameter failed (the C++ function is called, but the parameters are void)

Using WString also failed.

Unfortunately, JNA mappings don't refer to LPCWSTR type.

Any idea on this?

Upvotes: 4

Views: 2298

Answers (1)

Ben
Ben

Reputation: 35643

The JNI equivalent of LPCWSTR and LPWSTR is WString.

Java Strings map to char* or LPSTR or LPCSTR, but I believe will be UTF-8 endcoded, so can still pass the full character set.

Upvotes: 4

Related Questions