pb6.5调用vc++6.0的dll

thomasfu 2003-10-15 03:54:29
错误信息为:application terminated
error:specifed argument type differs from required argument type at runtime in dll function openportaa (invalid stack pointer on return from function call)
...全文
92 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
uday 2004-02-25
  • 打赏
  • 举报
回复
/*** 在vc里这样声明函数 ***/
WINAPI int myouts(char *a,char *b)
{ char tmp[1024];
strcat(a,b);
//memcpy(a,b,strlen(b)+1);
b[0]='3';
return 1;
}

/*** 在PB里这样申明:其中 REF 表示传参数(不是传值) ****/
function int myouts(REF string a,REF string b)LIBRARY "D:\vc6++s\win32dll\Debug\win32dll.dll"

/*** 这样调用 ****/
string a1,b1;
a1="wang++++++++";
b1="gaoqin";
//char a1[1024];
myouts(a1,b1);
MessageBox(a1,b1);
/ ********************* */

上面的代码我在PB8.0下正确运行
marcopolo 2004-02-25
  • 打赏
  • 举报
回复
我还有个调用dll的问题,源程序在一个机子上运行正常,可是换到另一台机子到了调用外部函数的时候,就出现一个提示窗口 “文件无法打开 ”然后就说“0x04472bb7”指令引用的“0x1186ff24”内存,该内存不能为“read”。不知道大家有没有碰到过这种情况,不知道是什么原因,高手指点
marcopolo 2004-02-25
  • 打赏
  • 举报
回复
把参数全换成字符串型,可能可以,我以前也遇到这种问题,后来改成字符串后,解决了,不知道你的问题能不能解决。
ActionStone 2004-02-08
  • 打赏
  • 举报
回复
谢了!->lovemoreh(爱比恨多)
iamknight 2003-12-25
  • 打赏
  • 举报
回复
建议采用DEF的方式从DLL中输出相关函数。
lovemoreh 2003-12-23
  • 打赏
  • 举报
回复
在PB帮助中查"What data type to use"即可查到数据类型转换的对照表:
Pointers

Data type in source code Size, sign, precision PowerBuilder data type
* (any pointer) 32-bit pointer Long
char * Array of bytes of variable length Blob
Platform notes Windows pointers 32-bit FAR pointers such as LPBYTE, LPDWORD, LPINT, LPLONG, LPVOID, and LPWORD are declared in PowerBuilder as long data types. HANDLE is defined as 32 bits unsigned and is declared in PowerBuilder as an UnsignedLong.

Near-pointer data types on Windows (such as PSTR and NPSTR) are not supported in PowerBuilder.

Characters and strings

Data type in source code Size, sign, precision PowerBuilder data type
char 8 bits, signed Char
string 32-bit pointer to a null-terminated array of bytes of variable length String
Platform notes LPSTR in Windows The 32-bit FAR pointer LPSTR is declared in PowerBuilder as string.

Boolean

Platform notes BOOL in Windows BOOL on Windows is 16-bit, signed. It is declared in PowerBuilder as boolean.

Fixed-point values

Data type in source code Size, sign, precision PowerBuilder data type
short 16 bits, signed Integer
unsigned short 16 bits, unsigned UnsignedInteger
int 32 bits, signed Long
unsigned int 32 bits, unsigned UnsignedLong
long 32 bits, signed Long
unsigned long 32 bits, unsigned UnsignedLong
Platform notes WORD and DWORD on Windows The Windows definition WORD is declared in PowerBuilder as UnsignedInteger and the Windows definition DWORD is declared as an UnsignedLong.

Short on 32-bit platforms On 32-bit platforms, you can't call external functions with return values or arguments of type short.

Floating-point values

Data type in source code Size, sign, precision PowerBuilder data type
float 32 bits, single precision Real
double 64 bits, double precision Double
Platform notes Doubles on Windows PowerBuilder does not support 80-bit doubles on Windows.

Date and time

The PowerBuilder data types date, DateTime, and time are structures and have no direct equivalent for external functions in C.
tommyhuanglei 2003-12-22
  • 打赏
  • 举报
回复
我的参数对照是
vc++编的dll在pb中怎么调用!帮帮忙
bool OpenComm(const char* pPort, int nBaudRate, int nParity, int nByteSize, int nStopBits);
vc里面声明的函数是这样的,在vc里面调用他们写的是
CString strCom="COM";
CString temp="";
pCB->GetWindowText(temp);
strCom+=temp;
if(OpenComm(strCom,CBR_9600,NOPARITY,8, ONESTOPBIT))
pb中我写的是
FUNCTION Boolean OpenComm(REF char pPort, int nBaudRate, int nParity, int nByteSize, int nStopBits) LIBRARY "smspdu.dll"
错误是
错误信息为:application terminated
error:specifed argument type differs from required argument type at runtime in dll function openportaa (invalid stack pointer on return from function call)
dingzhaofeng 2003-12-20
  • 打赏
  • 举报
回复
有对照表,我记得好像是在新出的一本介绍pb9的书中,一套共5本的。
tommyhuanglei 2003-12-20
  • 打赏
  • 举报
回复
不知道,我也遇到了,类似的问题!
incats 2003-12-08
  • 打赏
  • 举报
回复
VC里, 函数声明时, 加上WINAPI或__stdcall.

例:
DLLIMPORT int __stdcall GetDLLVersion(char* buf);
DLLIMPORT int WINAPI GetDLLVersion(char* buf);
jinqiang520 2003-12-08
  • 打赏
  • 举报
回复
我也遇到这个问题,有人能解决吗
heayhing 2003-12-06
  • 打赏
  • 举报
回复
我查了很多资料好象都是这个问题,无参数能正常调用
有参数老是提示数据类型不一致
sxzilch 2003-12-04
  • 打赏
  • 举报
回复
有VC++和PB的参数类型对照表吗?
我也碰到了这个问题,我用VC++写了一个DLL,在VFP和DELPHI中调正确,但在PB中有输入参数的调用时提示数据类型不一致,没有输入参数的调用正确.

workhand 2003-10-15
  • 打赏
  • 举报
回复
参数类型不匹配。

680

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder API 调用
社区管理员
  • API 调用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧