How to access an array of characters returned by a function in dll?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to C#.
I have a dll (writen in C++) which returns a char* from the function getName()
char* getName();

How do I access it from a c# application?
(It just returns a number,when I call it.
I know there is somehting wrong in the way I call it.)

Any help welcome.

Thank you in advance
Jacksree
 
Hi jacksree,

C# doesn't really use pointers so to be able to use the dll I suspect you
need to call it from an "unsafe" codeblock.

Happy coding!
Morten
 
Even after placing the call within an unsafe block, you will need to
compile it with the /unsafe switch.

Note: Have you converted the C++ DLL to .net using tlbimp and added
reference to it in your C# program?

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
Back
Top