return string to .Net application from c dll ?

D

Daylor

how can i return string to .Net application from c dll ?

i have the text in
char sText[100] ;

and i want to return it from c dll to .Net application.

i tried : *char in the function, but the didnt saw the string i passed.

what type/way i need to do ?



thanks and have a nice day.
 
V

Vadym Stetsyak

In .Net routine use
[return: MarshalAs(UnmanagedType.LPStr)]
public static extern string MyMethod(...)

In C char* MyRoutine(...);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top