In VB.NET, to import a method from DLL file can be written in:
DllImport
statement - new method introduced for .netDeclare
statement - old method since VB6
For the first one, the code looks like:
Imports System.Runtime.InteropServices
<DllImport("library_name.dll", EntryPoint:="entry_point", CallingConvention:=CallingConvention.Cdecl)> Public Function method_name(...) AS ...
End Function
And the above code works fine, I just wonder how to convert the code into the older way using Declare keyword as following:
Declare Function method_name Lib "library_name.dll" Alias "entry_point" (...) As ...
To make the question more specific, where can I add the CallingConvention
attribute into the Declare
statement?