2
Answers

Calling entry points in C# DLL

Administrator

Administrator

22y
2.5k
1
I find endless information on how C# can call other language functions in DLL, but nothing about how another language can call C# functions. From LotusScript (essentially VB) I want to either instantiate a C# object or simply call a C# function (or preferably be able to do both). I can't find any information on that in books or on the web. I create the DLL with: csc /target:library HelloWorld.cs I declare it with: Declare Public Sub Main Lib "HelloWorld.dll" Alias "Main" () (And I've tried other entry points.) Running the LotusScript I get "External function not found". Can anyone please point me in the right direction? --David
Answers (2)
1
Administrator

Administrator

Tech Writer 2.2k 1.6m 22y
There's an entire book devoted to this subject: COM AND .NET INTEROPERABILITY by Andrew Troelsen.
1
Administrator

Administrator

Tech Writer 2.2k 1.6m 22y
I'm making progress. I've discovered that calling C# (.NET) "managed" code from COM "unmanaged" code involves something called a COM Callable Wrapper. And one defines in the C# code the callable classes using Interface declarations. And then you can use regasm.exe (or the RegistrationServices class) to register the .NET objects. But I'm still not there. Following those procedures I created my interface, and a class for the interface. Registered that. All seemed okay. But when I attempt to CreateObject from my LotusScript (COM) program I get "Cannot create automation object." I've seen something called DllGetClassObject, but no specifics on how to use it. I wish msdn.microsoft.com had more and better examples. Again, any pointers/help would be much appreciated. --David