Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is wrong with this dll code?

Status
Not open for further replies.

rogerte

Programmer
Nov 9, 2001
164
GB
The following is puzzling me, and I caanot see what is causing the error.

Everytime I try to compile the following DLL code I get an error: Unknown directive 'LargeBadgeDialog' on the pas file just before the implementation section (Marked // error here ).

If I comment out every reference to either of the ...BadgeDialog (in both Pas and Dpr) then it compiles and each section runs perfectly.

I know I could, in theory, pass a variable to one procedure to define the type of form, but unfortunately I am not allowed to do that - don't ask - politics.

Can anyone out there explain what is wrong?

The DPR code is:
library Badge_Plate;

uses
SysUtils,
Classes,
BadgePrintForm in 'BadgePrintForm.pas' {BadgePrintFrm};

Exports
SmallBadgeDialog;
LargeBadgeDialog;

begin
end.

The BadgePrintForm.Pas starts:
unit BadgePrintForm;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Printers,
StdCtrls, ExtCtrls, CheckLst, Db, DBTables, IniFiles, JPEG; //, LLi, llo

const
INCHES_PER_MM : real = 0.04;

type
TOffset = record
X, Y: Integer;
end;

type
TBadgePlatePrintFrm = class(TForm)
PrintBtn: TButton;
ExitBtn: TButton;
ChkLBox: TCheckListBox;
Table1: TTable;
Panel1: TPanel;
TypeRdoGrp: TRadioGroup;
GetDataBtn: TButton;
PrintDlg: TPrintDialog;
Image1: TImage;
PhotoImage: TImage;
procedure PrintBtnClick(Sender: TObject);
procedure ExitBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure printsmallbadge;
procedure printlargebadge;
function capfirst( sText : string ) : string;
procedure TypeRdoGrpClick(Sender: TObject);

private
{ Private declarations }

public
{ Public declarations }
end;

var
BadgePrintFrm: TBadgePrintFrm;
nHandle : THandle;

Procedure
SmallBadgeDialog(aHandle : THandle);
LargeBadgeDialog(aHandle : THandle); // error here

implementation

{$R *.DFM}

// DLL Called Proceduress

//==================================================
Procedure SmallBadgeDialog(aHandle : THandle);
//==================================================
begin
nHandle := Application.handle;
try
Application.handle := aHandle;
BadgePrintFrm := TBadgePrintFrm.Create(Application);
BadgePrintFrm.caption := 'Small Badge Production';
BadgePrintFrm.showmodal;
finally
BadgePrintFrm.Free;
Application.handle := nHandle;
end;
end;

//==================================================
Procedure LargeBadgeDialog(aHandle : THandle);
//==================================================
begin
nHandle := Application.handle;
try
Application.handle := aHandle;
BadgePrintFrm := TBadgePrintFrm.Create(Application);
BadgePrintFrm.caption := 'Small Badge Production';
BadgePrintFrm.showmodal;
finally
BadgePrintFrm.Free;
Application.handle := nHandle;
end;
end;

// Rest of Form procedures/functions follow....
 
is this the exact code you use????

I notice that the export section is written:

library Badge_Plate;

uses
SysUtils,
Classes,
BadgePrintForm in 'BadgePrintForm.pas' {BadgePrintFrm};

Exports
SmallBadgeDialog;
LargeBadgeDialog;

begin
end.


shouldn't it be a comma (',') after:

Exports
SmallBadgeDialog, //comma instead of semicolon!
LargeBadgeDialog;
 
Bill

You are absolutely right - I have looked at that code so many times and did not see it.

It must be a case of seeing what I thought was there - not what was actually there.

Many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top