A
andrew lowe
Hi,
Sorry for posting this in C# group as well as C++, but i'm desperate for
some guidance....
I want to create a mixed mode C++ dll that calls a COM object and returns a
managed string. I use the following steps but still get errors:
Created a new C++ .Net Class library project
Add the #import directive to my managed objects header file: #import
"C:\Documents and Settings\alowe\My Documents\ePathwayRequestBrokerDev.dll"
rename_namespace("ePathwayCOM")
Add a new method:
System::String* Execute(String* serviceName, String* xml) {
BSTR service = (BSTR)(void*)Marshal::StringToBSTR(serviceName);
BSTR message = (BSTR)(void*)Marshal::StringToBSTR(xml);
ePathwayCOM::_esyv0004Ptr broker;
broker->exec(service, message);
Marshal::FreeBSTR((void*)service);
Marshal::FreeBSTR((void*)message);
return "test";
}
Followed the instructions in
http://support.microsoft.com/default.aspx?scid=kb;en-us;814472 to make the
necessary project property changes
Added the ManagedWrapper class as stated in the instructions in the link
above
I then created a C# project to call the manged method however the call to
System::String* Execute(String* serviceName, String* xml); fails with a huge
COM error
Can anyone point out any mistakes i'm making please. I'm extremely desperate
to get his working
Thanks a billion in advance
andrew
Sorry for posting this in C# group as well as C++, but i'm desperate for
some guidance....
I want to create a mixed mode C++ dll that calls a COM object and returns a
managed string. I use the following steps but still get errors:
Created a new C++ .Net Class library project
Add the #import directive to my managed objects header file: #import
"C:\Documents and Settings\alowe\My Documents\ePathwayRequestBrokerDev.dll"
rename_namespace("ePathwayCOM")
Add a new method:
System::String* Execute(String* serviceName, String* xml) {
BSTR service = (BSTR)(void*)Marshal::StringToBSTR(serviceName);
BSTR message = (BSTR)(void*)Marshal::StringToBSTR(xml);
ePathwayCOM::_esyv0004Ptr broker;
broker->exec(service, message);
Marshal::FreeBSTR((void*)service);
Marshal::FreeBSTR((void*)message);
return "test";
}
Followed the instructions in
http://support.microsoft.com/default.aspx?scid=kb;en-us;814472 to make the
necessary project property changes
Added the ManagedWrapper class as stated in the instructions in the link
above
I then created a C# project to call the manged method however the call to
System::String* Execute(String* serviceName, String* xml); fails with a huge
COM error
Can anyone point out any mistakes i'm making please. I'm extremely desperate
to get his working
Thanks a billion in advance
andrew