Big bucks the easy way !!!(500)

liuxiaowei 2001-04-04 01:52:00
I wrote a dll which exports a function like this:

int dividestr(char *s1,char *s2[])
{
......
return num;
}

s1 is a string made up of some words divided by spaces.
It's funtion is divide s1 into s2.
s2[0] is the first word;
s2[1] is the second.
....
number is the number of the words.
for example:
input :s1="I love you"
output :s2[0]="I",s2[1]="love",s2[2]="you",number=3;
My question is:
How can I use this dll in DEPHI and VB (static link an dynamic link)?
How can I declare the function in DEPHI and VB ?

500 marks !
...全文
115 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Wingsun 2001-04-04
  • 打赏
  • 举报
回复
可以在VB和Delphi中用这个函数,申明的方法已经有了,你的程序最好要是静态连接,否则在别的计算机上会出问题的.然后在VB和Delphi中动态连接比较好.
你的函数果是这样写的话那就没有export,你是不能在VB和Delphi中用到这个方法的,你需要改变你的申明方法,或者是export的方法.
holyfire 2001-04-04
  • 打赏
  • 举报
回复
这样不能被Delphi调用
改成
__declspec(dllexport) WINAPI int dividestr(char *s1,char *s2[])
{
....
return num;
}
liuxiaowei 2001-04-04
  • 打赏
  • 举报
回复
My declaration is:
extern "C" __declspec(dllexport) int dividestr(char *s1,char *s2[])
{
....
return num;
}
holyfire 2001-04-04
  • 打赏
  • 举报
回复
我的意思是C语言的DLL中声明要注意
VB中使用
Public Declare Function dividestr Lib "your.DLL" ( s1 As string , s2 As Any ) As Integer

liuxiaowei 2001-04-04
  • 打赏
  • 举报
回复
I mean in DEPHI and VB !
holyfire 2001-04-04
  • 打赏
  • 举报
回复
加一个声明
WINAPI int dividestr(char *s1,char *s2[]);

13,824

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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