金
金风吹雪
Unregistered / Unconfirmed
GUEST, unregistred user!
我要使用动态链接库:
=======================
动态库是这样的:
-----------------------
library Myddl;
{ 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;
function funSChar;
begin
Result:='LibraryOfFile is Myddl.ddl';
end;
exports
funS Name 'NewName';
{$R *.res}
begin
end.
----------------------
使用的程序是这样写的:
----------------------
unit uLibrary;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const
grid='MyddL.DDL';
function funSChar;stdcall;external grid name 'NewName';
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
S:string;
begin
S:=funS;
ShowMessage(S);
end;
end.
----------------------
工程文件:
----------------------
program pLibrary;
uses
Forms,
uLibrary in 'uLibrary.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
----------------------
运行可执行文件,即pLibrary.exe
结果出现了:
“没有找到'MyddL.DDL',因此,这个应用程序未能启动,重新安装应用程序扩展,可能会修复此问题.”
我的动态链接库那里出了问题?
怎样解决这个问题?
怎样做?
谢谢!
=======================
=======================
动态库是这样的:
-----------------------
library Myddl;
{ 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;
function funSChar;
begin
Result:='LibraryOfFile is Myddl.ddl';
end;
exports
funS Name 'NewName';
{$R *.res}
begin
end.
----------------------
使用的程序是这样写的:
----------------------
unit uLibrary;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const
grid='MyddL.DDL';
function funSChar;stdcall;external grid name 'NewName';
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
S:string;
begin
S:=funS;
ShowMessage(S);
end;
end.
----------------------
工程文件:
----------------------
program pLibrary;
uses
Forms,
uLibrary in 'uLibrary.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
----------------------
运行可执行文件,即pLibrary.exe
结果出现了:
“没有找到'MyddL.DDL',因此,这个应用程序未能启动,重新安装应用程序扩展,可能会修复此问题.”
我的动态链接库那里出了问题?
怎样解决这个问题?
怎样做?
谢谢!
=======================