How to use a C# DLL in Clarion 6.3

Hello,

I must use a C# dll writing by another company in my application (multi dlls).

This dll contains a public class which contain a public method.

When I try to load this dll in libmaker, I receive nothing.

Here is the structure :

namespace RegisterDocument
{
public static class CallApiDocument
{
public static bool Action(string processType, string key)

Is it possible to use this in Clarion and how to proceed ?

Thanks

Paul

Biac

One route is to create your own C# dll which exports static functions. These functions call public methods from another C# dll. In Clarion you call static functions from your dll.

Hi

As Mike said you will probably have to write a wrapper that allows you to export a method to be called from clarion unless the vendor of your dll’s is willing to do so.

This is done using the Nuget package “Unmanaged Exports” by Robert Giesecke. There are three different packages there for this depending on your setup. If VS2017 and below, use the original, VS2019 use UnmanagedExports.Repack and if using 2019 with .Net Core UnmanagedExports.Repack.Upgrade

It’s just a matter then of decorating the method for export. There few articles on here and also elsewhere on the web that should give you an idea of how to do this.

LibMaker has a bug that stops it finding .Net Exported methods in a dll, you can download a fixed version of LibMaker that works here

Regards

Mark

1 Like