Click here to Skip to main content
15,867,834 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I made an DLL in C sharp and added to my VC++ project in visual studio,a method of my DLL on calling return the status as "success" or what the error is.

I did some thing like this

char *a=interfacepointer->DLL Function



I get the garbage value in variable "a".
When i check it through my C# code the output is like this :-

ON SUCCESS:-
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Success</string>


ON ERROR

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Unknown database 'nhms_temp11'</string>


I should get the Value as "SUCESS" or "Unknown database 'nhms_temp11'"


What should i do?
Posted
Comments
Malli_S 9-Oct-12 9:27am    
What mechanism are you using to call the managed dll in native c++ project? Using interop ?
Tarun Batra 9-Oct-12 10:07am    
using COM,i solved the problem
Tejas Vaishnav 9-Oct-12 9:32am    
Not clear. please give more details...

Because char *a is a pointer, not a variable. The "garbage" as you call it is the memory address of your data.
In order to see that data you have to dereference your pointer again. Pointers[^]
 
Share this answer
 
Do like this
C++
BSTR s1=interfacepointer->DLL Function
std::wcout <<s1<<std::endl ;
 
Share this answer
 

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