C/C++ Wrapper help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AaronS

    C/C++ Wrapper help

    I'm working on a project that is using a 3rd party DLL, and I'm having trouble writing the wrapper for it in c#. I've searced for hours for the answer, and can just can't seem to find a solution for this one. I think a lot of it has to do with understanding and wrapping the pointers properly

    Here is the part of the C header file I'm working with

    typedef struct _HCLIEN

    PVOID Client
    auth *cl_auth
    } HCLIENT, *PHCLIENT

    #define CLIENT HCLIEN

    extern "C" CLIENT
    __stdcall
    Open_Client(cha r *Server, char System)


    Here is all I've been able to come up with as far as creating the wrapper

    [StructLayout(La youtKind.Sequen tial,Pack=4,Cha rSet=CharSet.An si)
    public struct HCLIENT

    public IntPtr Client
    public auth cl_auth
    }

    [DllImport("mydl l.dll")
    static extern int Open_Client(str ing Server, string System)

    public void blah(
    {
    int returnval = (int) Open_Client("pa ram1","param2")



    I'm hitting the DLL properly, but it always returns it's default error code, and never any other value. I know the dll works properly as I can run it fine with a test application written by the developers of the DLL

    Can anyone help

    Thanks in advance
    Aaron
Working...