How do I marshall (in ideally in SWIG) a C# string[] to a C++ string*?
-
I am new in C# programming and trying to call wrap functions that is in C++. In C++ I have a function of the following prototype string* swap(string* ptr1, string*ptr2){ //swap the array of string return ptr2; } How do I wrap this function into C# (ideally using http://en.wikipedia.org/wiki/SWIG, but not necessary)?
-
Answer:
I had the same question for Java. For Java, I did not find anything pre-packaged and trivial to use. I had to define my own typemaps. In case you don't get any better answers for C#, you could start with the SWIG/C++ code described at http://stackoverflow.com/questions/3753495/swig-how-to-wrap-stdstring-stdstring-passed-by-reference . You would need to replace references to Java types, JNI methods (those that include a reference to "jenv"), and "JavaThrowException." These files from SWIG might also provide some relevant example code for C#: swig/Lib/csharp/std_string.i swig/Lib/csharp/typemaps.i
leon at Stack Overflow Visit the source
Related Q & A:
- How can I echo characters before and after a string?Best solution by stackoverflow.com
- How can I convert a string number to a number in Perl?Best solution by Stack Overflow
- How can I burn a .rmvb file onto a DVD for viewing on a regular DVD player?Best solution by Yahoo! Answers
- How to search for a particular string in a text file using java?Best solution by Stack Overflow
- How do i isolate a in p=a+b+c?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.