saucecontrol
How can I use a precompiled C/C++ dll in a C# project?
reliant on pointers in a way that C# doesn't seem to supportthis is unlikely. there may be some opaque pointer typedefs that don't translate cleanly, but you can just declare those as
void*
in C#. a pointer is a pointer at the ABI level21 replies
How can I use a precompiled C/C++ dll in a C# project?
WINAPI means StdCall calling convention in C#, which is the default in Windows, so you can leave out calling convention if that's what your C DLL defines and you only care about Windows.
all you need for a proper DllImport declaration is to use compatible C# types for all args to the function.
the easiest way to generate compatible declarations these days is to use https://www.nuget.org/packages/ClangSharpPInvokeGenerator
you point the generator app at your library's .h file, and it will create C# bindings for you.
21 replies