On Wednesday, 29 June 2016 at 14:51:10 UTC, Thalamus wrote:
I was hoping there would be a code-only solution, and I'm glad
to see one is possible. It isn't quite working for me yet,
though. I can get the HINSTANCE in the CoLoadLibrary call, but
GetProcAddress for DllGetClassObject fails, with
ERROR_PROC_NOT_FOUND.
I've never written a COM server before (only clients), so I
must be building the C# assembly incorrectly. I'm just not sure
how. Everything across the board is built as 64-bit, and I've
selected "Register for COM interop". The C# is pretty simple:
A little research reveals that C# COM servers don't export
DllGetClassObject, or any of the COM server plumbing.
"Registering for COM interop" merely adds the registry entries -
which is the step you're trying to avoid by loading the DLL
dynamically. Then you'd run regasm on it to generate a type
library.
https://msdn.microsoft.com/en-us/library/aa645738(v=vs.71).aspx