DELPHI调用vc的dll,这样行么?(50分)

  • 主题发起人 tjzxj1977
  • 开始时间
T

tjzxj1977

Unregistered / Unconfirmed
GUEST, unregistred user!
小弟不了解vc编程,现有一vc做的MaxMin.dll文件(还有一个MaxMin.lib文件)
vc中的输出函数是
#define DLLEXPORT _declspec(dllexport);
extern "C"
DLLEXPORT UINT Max(int a,int b);
delphi中调用
interface
function Max(a,b:integer):cardinal;
stdcall;
implementation
function Max;external'MaxMin.dll' name 'Max';
问题是:
1.这样做能调用吗?
2.vc中的lib文件是做什么用的?(见笑!:))
如果能提供范例感激不尽,急等各位不吝指教!
 
可以参考一下Delphi帮助里关于DLL的内容
lib文件好像是DLL文件里函数的地址信息
 
可以使用Obj文件
 
简单问题,希望能获得直接一点的指点! :)
先谢过了!
 
vc中的输出函数是
extern "C"
_declspec(dllexport) UINT Max(int a,int b);
delphi中调用
interface
function Max(a,b:integer):cardinal;
stdcall;
implementation
function Max(A, B : Integer);external'MaxMin.dll' name 'Max';
这样肯定是可以调用的,前提确保你的MaxMin.dll在当前单元目录或者PATH环境变量定义的目录下就可以了
vc中的输出函数是
extern "C"
_declspec(dllexport) Func1(double a[]);
extern "C"
_declspec(dllexport) Func2(int &a);
可以采用和上面一样的定义
interface
procedure Func1(a : array ofdo
uble);
stdcall;
procedure Func2(var a : Integer);
stdcall;
implementation
procedure Func1(a : array ofdo
uble);
external '动态链接库名称' name 'Func1';
procedure Func2(var a : Integer);
external '动态链接库名称' name 'Func2';
 
多谢Beyondbill,我试试!
 
接受答案了.
 
顶部