• Welcome to Theos PowerBasic Museum 2017.

how to pass strings to c# dll from a PB exe

Started by Chris Chancellor, September 04, 2017, 05:59:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chris Chancellor

Hello

I wish to write a PB program which can call up a C# dll and then able to pass some strings
to this C# dll.   All help such as an example code is much appreciated.

José Roca

Nine years ago I did a test out of curiosity, but as I don't do .Net programming I didn't do further research.

I remember that we have to host the .NET runtime, load the asembly and create an instance of the wanted .NET class with the CreateInstanceFrom method of the ICLRHost interface and use COM Automation to call the methods of the .NET class.

See: https://code.msdn.microsoft.com/CppHostCLR-e6581ee0/sourcecode?fileId=21953&pathId=641528413

Patrice Terrier

Wanting to link PB with a .NET DLL, sounds weird for me.
What is the benefit of using Win32 if you have to mix it with bloated IL...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com