如何写一个供VB6调用的DLL,并请看看给的例子是否有问题?
我用Delphi6写了一个很简单的DLL,结果VB6调用的时候报错“找不到此函数的入口”。可以肯定的是VB6调用DLL函数的写法是正确的,就是不能判断Delphi6写的这个例子是否有问题,请不吝赐教。
例子源码如下:
library Simple;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes;
{$R *.res}
function add1(Ai: Integer): Integer; stdcall;
begin
Ai:= Ai + 1;
end;
exports add1 index 1;
begin
end.