user1209245
user1209245

Reputation: 11

Importing a dll file written in C or C#

I am trying to import a .dll file which is written in C to Microsoft Visual C# Studio 2010?

Any ideas why I keep on getting this error?

Please make sure that the file is accessible and that it is a valid assembly prompt.

Upvotes: 1

Views: 389

Answers (2)

Tim Rogers
Tim Rogers

Reputation: 21723

I suspect you're not using the DllImportAttribute correctly (or at all). See here: http://msdn.microsoft.com/en-us/library/aa984739(v=vs.71).aspx

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 613461

You cannot import a reference to a native DLL. Instead you need to use p/invoke to import each function one by one. This can be a rather laborious process if you have a lot of functions so sometimes a C++/CLI wrapper is more convenient.

Upvotes: 1

Related Questions