Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Data Marshalling const char* return type

$
0
0
I'm making a mac OSX plugin for a large C library that has many const char* 's as return types.
I'm testing with two simple functions but they both cause unity to hang and then crash when I call them. Anyone done this before and have it working?

Code (CSharp):
  1. const char* getString()
  2. {
  3.     return "Got String"
  4. }
  5.  
  6. const char* getStringOnHeap()
  7. {
  8.     char* foo = malloc(sizeof(char) * 20);
  9.     foo = "Got heap String";
  10.     return foo;
  11. }
Code (CSharp):
  1. [DLLImport(BundleTest)]
  2. public static...
Data Marshalling const char* return type

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>