0
votes

I develop Delphi application that uses .Net dll (written in C#) that uses another .Net dll (probably C#). Let me give them names A.dll and B.dll.

I have the source code of the A.dll but not B.dll. I cannot use B.dll from Delphi app because B.dll was written only for C# applications (i.e. without COM interop) so i'm using my A.dll to work with B.dll.

B.dll creates 2 pipes to exchange messages with A.dll. The problem is that B.dll cannot(!) connect to these pipes on different computers. However if I create A.exe instead of A.dll all is absolutely ok (pipes are connected and whole messages exchange process is ok).

On my PC I always build A.dll and Delphi app. How I understand Visual Studio automatically use commands 1) regasm - to register A.dll, 2) tlbexp - to get A.tlb file.

After that I import A.tlb into Delphi app via "Import Type Library command".

On another computer here is the problem that in A.dll procedure pipes are never connected (I've used logs to understand this). By saying "never connected" I mean infinite waiting for the result of pipe.WaitForConnection() command (in c#).

Can anyone help me with this problem? Why "A.exe" is ok for Delphi app but not "A.dll" ?

Thanks

2
Nobody can help you without any real information. The reason for the lack of response is that there is no actionable detailed information. - David Heffernan

2 Answers

0
votes

I've investigated this problem. Firsly, that is bad idea to use dll inside of other dll. According to many articles there can be troubles with GetProcAddr and some other functions. Secondly, I've developed C# app to communicate with both B.dll and Delphi app. Also, I use pipes to do this.

0
votes

The easiest way to use managed code from Delphi is through COM, but you don't like that way.

If your DLL targets for .NET Framework 4.x, then then you can use DllExport

In case you are developing DLL that targets for .NET Core or .NET Standard, I recommend reading this article: https://docs.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting

I've tried all 3 ways and they all work. The last also works well on Linux and macOS.