Theos PowerBasic Museum 2017

General Category => General Discussion => Topic started by: Chris Chancellor on September 04, 2017, 05:59:05 PM

Title: how to pass strings to c# dll from a PB exe
Post by: Chris Chancellor on September 04, 2017, 05:59:05 PM
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.
Title: Re: how to pass strings to c# dll from a PB exe
Post by: José Roca on September 05, 2017, 04:29:38 AM
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
Title: Re: how to pass strings to c# dll from a PB exe
Post by: Patrice Terrier on September 05, 2017, 10:03:19 AM
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...