Reputation: 12424
I have read about extern
in MSDN:
http://msdn.microsoft.com/en-us/library/e59b22c5.aspx
I'm not sure what is the difference between using extern
than just adding the dll as a reference to the project.
Upvotes: 1
Views: 832
Reputation: 399
One difference: if you want t copy or reuse of this code, DllImport work fine.
Upvotes: 0
Reputation: 6490
As it is stated it is typically used with DllImport
.
A common scenario with DllImport
is using native dlls instead of managed ones.
As you cannot add native dlls to your project as a reference you need to import it during runtime.
If you have managed assemblies it is typically better to indeed reference it in your project.
See the samples of your link, they import native libraries and call functions on them.
Upvotes: 4