x


Plugin return valid string value first time

 DllImport("SimplePlugin")]
 private static extern string mainSort();
 [DllImport("SimplePlugin")]
 private static extern string testString();
 
 Debug.Log(testString());
 Debug.Log(mainSort());

I wrote a C++ plugin contains a very complicated function mainSort() and return a string while testString() is just return a "Hello" string. When I run it in Unity, the C# script get a valid return value first time while after the first time it works good, and if I change the return value into other type it works good too. And further more, if I call the testString() function before the mainSort() both function work perfectly, so I am totally confused about the reason. Any one meet this problem before? Or any solutions?

more ▼

asked Aug 23, 2012 at 10:50 AM

wsycarlos gravatar image

wsycarlos
1 3 2 2

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x672
x641
x131
x69
x6

asked: Aug 23, 2012 at 10:50 AM

Seen: 695 times

Last Updated: Aug 23, 2012 at 10:50 AM