Question

I have recived a SDK from a 3. party. The SDK provides a big bunch of .dll / .lib / .h files But I cannot access any of the files from C#.

I have tried to add the dll's as reference to my C# project, but it pops up and says: "A reference to 'xxx.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."

And I am not sure how to use the .lib / .h file to access the 3. party SDK. The SDK comes with some sample code that is written in C which accesses the SDK using the .lib/.h files.

How do I access the SDK from C#?

Was it helpful?

Solution

If the SDK provided to you just contains .dll .lib and .h files means that is a native library (C or C++ library).

For use it you should have a wrapper from this SDK to your managed C# code.

If there isn't the wrapper inside the SDk you should make one by your own via P/Invoke.

This is a summary from MSDN about P/Invoke (not esaustive, just for give you the idea): Platform Invoke Basics

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top