请教:VB.NET调用dll和VB调用dll的问题
我在VC中写了一个导出函数:
extern "C" __declspec(dllexport)
HRESULT Init(LPCSTR lpcsParam = NULL)
{
...
}
在VB.NET 中:
Imports System.Runtime.InteropServices
<DllImport("example.dll", CallingConvention:=CallingConvention.Cdecl)> _
Public Function Init(ByVal lpcsParam As String) As Integer
End Function
调用Init可以成功。
在VB6.0中:
Private Declare Function Init Lib "example.dll" (ByVal lpcsParam As String) As Integer
但在调用时报“DLL 调用约定错误”。
请问VC中导出函数的声明是否有问题呢?