Jump to content
Excelsior Forums

Andreas

Members
  • Content count

    0
  • Joined

  • Last visited

    Never

Community Reputation

0 Neutral

About Andreas

  • Rank
    Newbie
  • Birthday 01/01/01
  1. Problem dereferencing a Pointer

    Please forget everything i wrote. I found the error after a day of searching. It was a stupid error. Thanks to everyone. Andreas
  2. Problem dereferencing a Pointer

    The UserAccountStruct is defined like this: public class UserAccountStruct extends Structure implements UseraccountIf { public static final int SLC_MD5_DIGESTSIZE = 16; String username = ""; char[] pw = new char[sLC_MD5_DIGESTSIZE]; int pwlen = 0; String completeName = ""; public String defineLayout() { String str = "CSTRING username, " + "char[" + Integer.toString(SLC_MD5_DIGESTSIZE - 2) + "] pw, " + "int pwlen, " + "CSTRING completeName"; return str; } .... } The SLC_MD5_DIGESTSIZE is 16.
  3. Problem dereferencing a Pointer

    Hello, i have a problem passing a structure from Java to a C-DLL and vice versa. The structure looks like this: typedef struct Userdata { char* username; char pw[sLC_MD5_DIGESTSIZE]; int pwlen; char* completename; } TUserData; The called functions header looks like: __declspec(dllexport) int __stdcall createUser (TUserData* userdata); The DLL will be called from java with f = new xFunction(dllName, "int " + funcName + "(" + ccdefPackage + ".UserAccountStruct*)"); Pointer arg1 = null; arg1 = Pointer.createPointerTo(accountdata); errVal = ( (Integer) f.invoke(arg1)).intValue(); accountData = (UserAccountStruct) arg1.deref(); After dereferencing the argument 1, the char- array has lost the last two charactes. The starting size is 16, after dereferencing the size of the array is 14. Have anybody seen this before? How can i solve the problem? Best regards Andreas
×