Returning unicode string through function argument.

Hi all,

I have following function written in a C++ dll. I need to be able to call it from Java using JNI. This function expects to receive a buffer pointed by wchar_t * of "int len" length. It will copy write some text in to this buffer and i need to be able to get this updated Unicode string in Java code. please let me know how to write Java code to call this function.

int getWString(wchar *ch,int len)

{

wcsncpy( ch, L"Hello unicode world", len);

return 1;// no error

}

Best Regards

Noman Khan

[762 byte] By [Noman_Khana] at [2007-10-3 10:07:15]
# 1
You can't.You have to write some C "wrapper" code that meets the java interface, and have it call the C function and handle the return.Java doesn't do output parameters, especially wchar_t* s.
bschauwejavaa at 2007-7-15 5:26:46 > top of Java-index,Java HotSpot Virtual Machine,Specifications...