|
Java char *INOUT doesn't OUT: msg#00143programming.swig
Hi, I'm using SWIG-1.3.22 on Windows with Java JDK 1.4.2. I'm trying to wrap a C DLL. All parameters are passed as pointers (int *, double *, and char *). Most parameters are *INPUT, but some are *INOUT. The int *INOUT and double *INOUT work as expected by turning the parameter into a single dimensional array. But a char *INOUT turns the parameter into a String, basically making it a char *INPUT. I expected the char *INOUT to allow me to pass Strings back and forth via a 1-dimensional array just like int *INOUT. Am I off track? Is there a better method to do this? Through my struggles I also tried the *SBUF and *BYTE methods. Unfortunately neither worked for me. The *SBUF caused Access Violations because the char array was a different length than the string contained in the StringBuffer. It was using the capacity of a StringBuffer instead of the length of the String contained in it. I tried changing the typemap to use length. Then I received Access Violations when the resulting string was being appended back to the StringBuffer. I wasn't able to figure out why that was failing. The *BYTE caused garbage to be pasted back into my String. I was using the BYTE method this way: String s = "0123456789"; byte[] b = s.toByteArray(); int r = DLLWrapper.getResult(b); s = new String(b); System.out.println(s); This resulted in garbage printouts. Any advice on the best/easiest way to do this? Thanks, Gary _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | How to return a std::vector of pointers to Java?: 00143, Henrietta Slack |
|---|---|
| Next by Date: | Re: complex output argument: 00143, William S Fulton |
| Previous by Thread: | How to return a std::vector of pointers to Java?i: 00143, Henrietta Slack |
| Next by Thread: | Re: Java char *INOUT doesn't OUT: 00143, William S Fulton |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |