danielmhanover
danielmhanover

Reputation: 3124

How to make a PInvokeable DLL

I am trying to make a program which will need to execute a lengthy algorithm over and over again, so C++seemed like the obvious choice to me. However, in order to make it look aesthetically pleasing, and to make its other functions easier to make, I built it in C# and made the algorithm in C++.

As far as I am aware, the best way for me to use the C++ function in my C# program is to PInvoke it. However, when I try to PInvoke the function from the DLL, I get an error saying

"Unable to find an entry point named <name> in DLL"

When I made my DLL, I used Visual C++ and created a Win32 Console application, selected DLL from the choices, and created the function in the test.cpp file. What did I do wrong?

Upvotes: 1

Views: 114

Answers (1)

SLaks
SLaks

Reputation: 887195

You need to export the function in the native DLL.

Upvotes: 1

Related Questions