I have a C# dll function that I would like to call from RealBasic using a Declare function. I have included in my C# DLLExport declarations that will make my function available to RB using the Declare directive and can call my function. The issue I am running into is passing byref variables (from RB) to the procedure.
I would like to pass back the values from my C# function to RB, but this always returns a value of 0. How should I declare the parameters in my C# function if I would like to pass by float or int variable types?
C# side:
[DllExport(“myFunction”, CallingConvention = CallingConvention.Cdecl)]
public static Int32 myFunction(String sPort, int _X, int _Y, int _Z)
…
RB side:
Declare Function myFunction Lib “MyDLL.dll” (X As Integer, Y As Integer, Z As Integer) As Integer
_X, _Y, _Z As Integer
dim ret As Integer = myFunction(_X, _Y, _Z)