Using “C” dll in C# [duplicate]

2019-08-02 14:45发布

问题:

Possible Duplicate:
How do I call unmanaged C/C++ code from a C# ASP.NET webpage

I have a dll file that is written in "C" language, i want to use it in C#. How can i do that?

回答1:

You can use PInvoke

Platform Invocation Services (PInvoke) allows managed code to call unmanaged functions that are implemented in a DLL.

Here is a great tutorial by the NAG (Numerical Algorithms Group) group



回答2:

You can do a DllImport in your C# code and then use PInvoke.

For your custom dll you can try this example answer on SO.

This a good website for reference for using windows dlls



标签: c# c dll