Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi, I have a DLL, written in C#, my general application - ATL project with MFC support. The DLL works with string type data, accepts them and transfers back. What data type should I use to transfer string into DLL and to receive them from there? Should I use "string" or "ref string" in DLL to receive data? I'm a little confused with LPCTSTR, TCHAR, BSTR, CHAR....
.........DLL connected like this Exporting Managed code as Unmanaged.
Posted
Updated 23-Aug-10 7:54am
v3
Comments
Eugen Podsypalnikov 19-Aug-10 14:14pm    
Is there an IDL file of that DLL ? :)

This article has a great explanation for this:

http://blogs.msdn.com/b/ericlippert/archive/2003/09/12/52976.aspx[^]

Mark this question as answered if it helps you. This way other people may refer to this for their answers.
 
Share this answer
 
v2
Comments
Dalek Dave 23-Aug-10 9:55am    
Good Call.
BSTR is the best string type to use.
 
Share this answer
 
Comments
Dragonfly_Lee 23-Aug-10 2:48am    
would you mind to explain why or give us some links?
OK, I used char* in non Unicode project. It works OK.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900