vb中调用C动态链接库的问题
库内容
// File: MYPUTS.C.
// The myPuts function writes a null-terminated string to
// the standard output device.
#include <windows.h>
__declspec(dllexport) int __cdecl myPuts(LPTSTR lpszMsg)
{
// if you want to a function can be used in other pro,you must
// add flag __declspec(dllexport)
DWORD cchWritten;
HANDLE hStdout;
// Get a handle to the standard output device.
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
// Write a null-terminated string to the standard output device.
while (*lpszMsg)
WriteFile(hStdout, lpszMsg++, 1, &cchWritten, NULL);
return 0;
}
VB工程调用
Private Declare Function myPuts Lib "e:\vb98\dll\myPuts.dll" (ByVal lpszMsg As String) As Integer
Private Sub Command1_Click()
Dim showStr As String
showStr = String(32, 0)
showStr = "123"
myPuts showStr
End Sub
问题:
BAD DLL calling convention
求助,谢谢!