Prev: get CPU usage (like in task manager) and FreePhysicalMemory
Next: Adding a method in InitializeComponent() using codedom from userc
From: Peter Duniho on 28 Mar 2010 21:39
Daniel W. wrote:
> C# bridge implementation so far:
> [DllExport] // http://www.codeproject.com/KB/dotnet/DllExporter.aspx?msg=3267441
Wow. That seems overly complex.
If I were doing this (and thankfully, I'm not :) ), I would expose my
managed code as a COM object. Then I would either access the COM object
directly from the unmanaged code, or I would write an unmanaged wrapper
that does that.
In your case, it sounds like the latter would be necessary, since the
original Delphi isn't expecting a COM object, nor are you able to change
it so that it does.
Post-processing a managed assembly seems unreasonably complicated to me.
Not that COM is trivial to get right, but .NET and Windows both
already have significant built-in support to handle conversion to and
from COM-friendly types and marshaling function calls between unmanaged,
COM, and managed code. Seems like it would make more sense to take
advantage of that.