Angshuman Agarwal
Angshuman Agarwal

Reputation: 4866

P/Invoke - C# signature for Custom Types using DLLImport?

void MyUnmanagedFunc(
          CustomClass&   szOutputData
        , ICustomObject* pDataObject
        , const LPCWSTR   szTag
        , const LPCWSTR   szDisplay = NULL
        , const BOOL      bAdd = TRUE
    );

I have the above signature of a function defined in a C++ DLL say, abc.dll. I am not able to create the proper method signature in C#. Note, that the CustomClass is defined in sometherfile, say, xyz.dll and with __declspec(dllexport). I tried this tool to generate the signature.

Sorry, if I have repeated the question. I have tried to search over before posting.

Upvotes: 3

Views: 534

Answers (1)

rudolf_franek
rudolf_franek

Reputation: 1885

Possible solution is to create mixed assembly written in C++. It can include any necessary headers and call method above from abc.dll and it can expose managed wrapper in the same time.

Upvotes: 1

Related Questions