Parameter for .NET wrapper for aaApi_GetGuidsFromFileName

INT  aaApi_GetGuidsFromFileName (LPGUID *fileGuids, int *nbGuids, LPCSTR inputFileName, int validateWithChkl)

I'm trying to figure out what type C# parameter I need to use for the LPGUID *fileGuids parameter in the aaApi_GetGuidsFromFileName function.

Any help would be greatly appreciated.

Parents Reply Children
  • Dean, thank you for your quick reply durring this holiday season. That is the approach I am trying now.

    Couple of quick questions.
    1) Should I use an IntPtr in my wrapper for the ProjectWise structure point (LPGUID*)?
    2) Should my C# Structure be named the same as the LPGUID Structure?
    3) Should the numGuids be passed by ref?

    Here is the method definitions:
    ProjectWise
    INT aaApi_GetDocGuidsFromFileName (LPGUID* fileGuids, int* nbGuids, LPCSTR inputFileName)

    My .NET Wrapper
    public static extern int pwGetDocGuidsFromFileName(ref IntPtr fileGuids, int numGuids, string fileName);

    Here is the C# Structure I am going to use.

    [StructLayout(LayoutKind.Sequential)]
    public struct LPGUID
    {
    public uint Data1;
    public ushort Data2;
    public ushort Data3;
    public char[] Data4 = new char[8];
    }

    Thanks for your help, Merry Christmas :)
  • Merry Christmas to you too. :)

    1.) Yes, it is returning a pointer so that should be an IntPtr
    2.) The name does not matter, but for clarity and sanity you should name it the same.
    3.) No, it is an integer of the number of Guids returned.
    I don't think you should pass the fileGuids variable by Ref either. My reasoning is that to pass by ref, you would have to build the memory location the structures are going into before calling the function. Try not using Ref, and instead marshal accross each structure in a loop for the numGuids returned.