java - JNA invalid memory access -


i'm testing jna befor wraping big dll. basic functions different types args works. when wrap (even simple) approved code wich has standart method mbstowcs_s inside, apears:

exception in thread "main" java.lang.error: invalid memory access     @ com.sun.jna.native.invokepointer(native method)     @ com.sun.jna.function.invokepointer(function.java:490)     @ com.sun.jna.function.invokestring(function.java:654)     @ com.sun.jna.function.invoke(function.java:427)     @ com.sun.jna.function.invoke(function.java:354)     @ com.sun.jna.library$handler.invoke(library.java:244)     @ com.sun.proxy.$proxy0.testwchar_in(unknown source)     @ gov.nbu.app.main(app.java:85) 

all versions 32bit.

problem wasn't in jna. appears on cpp side on machines (my case). here is:

void testvoid(void) {     wchar_t                     wcbuffer[2600]      = {};     size_t                      szout               = 0;     std::string                 path                = "this message test wchar.";     errno_t                     errcode             = 0;      // work:     errcode = mbstowcs_s(&szout, wcbuffer, sizeof(wcbuffer), (char*)path.c_str(), path.size());     // not work:     errcode = mbstowcs_s(&szout, wcbuffer, path.size(), (char*)path.c_str(), path.size());  } 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -