Re: minimizing the cost of managed/unmanaged collaboration
Alan Baljeu <[email protected]> Mon, 2 Apr 2007 17:51:29 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <024c01c77571$12299de0$1dc80ac6@CTI> |
Okay, so I have a tentative plan to convert significant amounts of C++ into managed code,
and to make classes like this one managed:
class MyCplusPlusClass
{
void DoStuff(IManagedObject managedObject) // native method
{
double foo = managedObject->GetFoo("key");
_bstr_t bar = managedObject->GetBar("key");
NativeApi(foo, bar);
}
};
To achieve this I must master compiling my C++ code as managed, and switch from #importing
COM to #using .NET. This will require exchanging COM smart pointers with __gc pointers.
(Or I could rewrite to C#, but I suppose that's more work.) Beyond that I don't really know
what it will take.
In the case where static linking is required, I shall split my lib project into a DLL and a
lib, with the DLL being managed and the lib exporting new native methods to call. The above
class would go in the new DLL. Does anyone foresee troubles along this route?
Alan
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com