Calling Clarion procedures from C#

Clarion Prototypes

aStrToStr FUNCTION(BSTRING pInput), BSTRING, PASCAL, NAME('aStrToStr')
Multiply  FUNCTION(BYTE A, BYTE B), BYTE, PASCAL, NAME('Multiply')
Msg       PROCEDURE(), PASCAL, NAME('Msg')

C# Prototypes:

[DllImport("bobavi.dll", ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.BStr)]
public static extern string aStrToStr ([MarshalAs(UnmanagedType.BStr)] string pInput);

[DllImport("bobavi.dll", ExactSpelling = true)]
public static extern byte Multiply(byte A, byte B);

[DllImport("bobavi.dll", ExactSpelling = true)]
public static extern void Msg();

It is important to use NAME in Clarion and ExactSpelling in C# to get the name matching correct.

don’t forget to check the basics:

  • Are the procedures exported -> Dependency Walker
  • Are you talking to the correct DLL version.
4 Likes