有关VC调用DELPHI开发的动态连接库的问题,请帮忙 兄弟我用DELPHI5开发了一个动态连接库,其中输入、输出参数为PCHAR类型,在使用VC来调用时,有些问题,请问VC中使用什么类型的参数。请各位帮忙解答。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 typedef int (__stdcall * pPrintRecord)(LPTSTR szStr); //调用打印模版 打印报表 HINSTANCE hLibrary; pPrintRecord PrintRecord; hLibrary=LoadLibrary("PrintDll.dll"); if(!hLibrary) { ShowMessage2("打印模块PrintDll.dll丢失"); return; } PrintRecord=(pPrintRecord)GetProcAddress(hLibrary,"PrintRecord"); CString str; int a= (*PrintRecord)(str.GetBuffer(0));//直接打印 FreeLibrary(hLibrary); netfyee(VC初学者,DELPHI遗忘中....) 你好。使用你的方法好象不行我的程序是这样的,请指教DELPHI中 function test(var teststr: PChar):integer;stdcall;function test(var teststr: PChar):integer;begin Result := 0; StrPCopy(teststr,'aaaaaaaa');end;VC typedef int (__stdcall * pTest)(char *szStr); HINSTANCE hLibrary; pTest Test; hLibrary=LoadLibrary("test.dll"); if(!hLibrary) { AfxMessageBox("can't open dll file"); return; } Test=(pTest)GetProcAddress(hLibrary,"test"); char *buffer; int a= (*Test)(buffer); //此处出错 CString s=buffer; AfxMessageBox(s); FreeLibrary(hLibrary); char *buffer;int a= (*Test)(buffer); //此处出错-----------------------------你还没给buffer分配空间呢,当然会错了。char *buffer;-----》char buffer[100]; ajn_sailing(我心飞翔) 你好按照你的做法,还是不行 错误信息为:Unhandled exception in dlltest.exe(test.dll):0xC0000005:Access Violation function test(var teststr: PChar):integer;stdcall改为function test(teststr: PChar):integer;stdcall因为teststr已经是指针 有没有人有<Visual C++ 2008入门经典>中文版? 简单的CDC问题 关于主程序与ActiveX控件的问题 请叫窗体滚动条 一个问题,请路过的高手帮个忙!!谢谢!!! 在view类中映射CMainFrame类中的成员函数,出错,请教 100分望高手指点! 如何隐藏系统托盘栏图标! ACTIVESKIN如何让splitter条也有皮肤覆盖????? 如何在Vista下通过编程修改注册表HKEY_LOCAL_MACHINE下的任何键值 如何做一个OICQ风格的AppBar? 左值的详细含义 一个老问题,希望大家能指导一下!分多多,不够在补
HINSTANCE hLibrary;
pPrintRecord PrintRecord;
hLibrary=LoadLibrary("PrintDll.dll");
if(!hLibrary)
{
ShowMessage2("打印模块PrintDll.dll丢失");
return;
}
PrintRecord=(pPrintRecord)GetProcAddress(hLibrary,"PrintRecord");
CString str;
int a= (*PrintRecord)(str.GetBuffer(0));//直接打印
FreeLibrary(hLibrary);
DELPHI中
function test(var teststr: PChar):integer;stdcall;function test(var teststr: PChar):integer;
begin
Result := 0;
StrPCopy(teststr,'aaaaaaaa');
end;VC
typedef int (__stdcall * pTest)(char *szStr); HINSTANCE hLibrary;
pTest Test;
hLibrary=LoadLibrary("test.dll");
if(!hLibrary)
{
AfxMessageBox("can't open dll file");
return;
}
Test=(pTest)GetProcAddress(hLibrary,"test");
char *buffer;
int a= (*Test)(buffer); //此处出错
CString s=buffer;
AfxMessageBox(s);
FreeLibrary(hLibrary);
int a= (*Test)(buffer); //此处出错
-----------------------------
你还没给buffer分配空间呢,当然会错了。char *buffer;-----》char buffer[100];
按照你的做法,还是不行
Unhandled exception in dlltest.exe(test.dll):0xC0000005:Access Violation
function test(teststr: PChar):integer;stdcall
因为teststr已经是指针