Clarion DLL call from C #

I am currently working on an IT company. They made their software using Clarion, and in this software they have a DLL that recounts many values ​​from their database. I need to call this DLL from my C # project. I tried everything without working.

My code is as follows:

public partial class Form1 : Form
{
    [DllImport("EPNORM.dll", EntryPoint = "MyRecalcualate@FlOUcOUcOsbOUc")]
    public static extern void MyRecalcualate(System.Int64 myPtr, System.Int64 myLong, CWByte myByte);

    [DllImport("User32.dll")]
    public static extern Boolean MessageBeep(UInt32 beepType);

    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        System.Int64 myPtrTemp = 1234;
        System.Int64 myLongTemp = 5678;
        System.Byte myByteTemp = 88;

        try
        {
            MyRecalcualate(myPtrTemp, myLongTemp, myByteTemp);
            bool messagebeep = MessageBeep(1);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
        finally
        {
            MessageBox.Show("Successful");
        }
    }
}

The problem is that when I call it using breakpoints, it just disappears in the method MyRecalcualateand reaches the block finalllyafter 2 seconds and re-displays without doing anything from the DLL. Is it because there is something in the DLL method that I need to fix, or because I'm doing the wrong call incorrectly?

Parameters of the following call: MyRecalculate (LONG, LONG, BYTE)

MyRecalcualate      PROCEDURE (MyStringPtr, MyLong, MyByte) ! Declare Procedure
LOC:CString         CSTRING(255)
LOC:Byte            BYTE
CODE
! clear completely LOC:CString with null values
LOC:CString = ALL('<0>', SIZE(LOC:CString))

! load string value, byte by byte, from memory address passed (MyStringPtr) and put into LOC:CString
I# = 0
LOOP
     PEEK(MyStringPtr + I# , LOC:Byte)
     IF LOC:Byte = 0 THEN BREAK END
     LOC:CString[I# + 1] = CHR(LOC:Byte)
     I# += 1
END

MESSAGE('MyString value is:||' & CLIP(LOC:CString))
MESSAGE('MyLong value is:||' & MyLong)
MESSAGE('MyByte value is :||' & MyByte)

, VB.NET: VB.NET CODE: http://imageshack.us/photo/my-images/269/callfromvisualbasictocl.jpg/ : http://imageshack.us/photo/my-images/100/asdxg.jpg/

+3
1

- . Int64. pinvoke :

[DllImport("EPNORM.dll", EntryPoint = "MyRecalcualate@FlOUcOUcOsbOUc")]
public static extern void MyRecalcualate(string myPtr, int myInt, byte myByte);

, , Clarion LONG, 32- . , int #. , Clarion. , stdcall, #.

+2
source

All Articles