Menu

dot.net example, Par_BRecv method signature

2014-04-22
2014-04-22
  • Rafael Rocha Fernandes

    Hi,

    First of all I would like to say congratulations for your work in this library.

    I noticed a minor issue in the BRecv method signature from the S7Partner class (only in the dot.net wrapper), I fixed it in my test environment and it works fine now.

    snap7_libmain.h :
    EXPORTSPEC int S7API Par_BRecv(S7Object Partner, longword &R_ID, void *pData, int &Size, longword Timeout);

    snap7.net.cs (not working) :

    [DllImport(S7Consts.Snap7LibName)]
    protected static extern int Par_BRecv(IntPtr Partner, UInt32 Timeout, ref UInt32 R_ID, byte[] Buffer, ref Int32 Size);
    public int BRecv(UInt32 Timeout, ref UInt32 R_ID, byte[] Buffer, ref Int32 Size)
    {
    return Par_BRecv(Partner, Timeout, ref R_ID, Buffer, ref Size);
    }

    It should be:

    [DllImport(S7Consts.Snap7LibName)]
    protected static extern int Par_BRecv(IntPtr Partner, ref UInt32 R_ID, byte[] Buffer, ref Int32 Size, UInt32 Timeout);
    public int BRecv(ref UInt32 R_ID, byte[] Buffer, ref Int32 Size, UInt32 Timeout)
    {
    return Par_BRecv(Partner, ref R_ID, Buffer, ref Size, Timeout);
    }

    It is a pleasure to contribute with your library.

    Best Regards,
    Rafael Rocha Fernandes
    Automation Systems Analyst

     
  • Davide Nardella

    Davide Nardella - 2014-04-22

    Thank you very much Fernando !
    I will fix it in the next release and in the news asap, since the problem is only in the wrapper.

     

Log in to post a comment.