namcit99
asked on
How to call a function in library code
Dear advisor
The code
library aaaaa ;
Function Total(X, Y: Integer): Integer; stdcall;
begin
x := ChoiceQuanTiTy(x,y) ;
Total := x + y ;
end;
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall;
begin
if X < Y then ChoiceQuanTiTy := X else ChoiceQuanTiTy := Y;
end;
exports
Total,
ChoiceQuanTiTy ;
begin
end.
[Error] Project2.dpr(5): Undeclared identifier: 'ChoiceQuanTiTy'
Please correct for me. How to use a function in the same library
The code
library aaaaa ;
Function Total(X, Y: Integer): Integer; stdcall;
begin
x := ChoiceQuanTiTy(x,y) ;
Total := x + y ;
end;
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall;
begin
if X < Y then ChoiceQuanTiTy := X else ChoiceQuanTiTy := Y;
end;
exports
Total,
ChoiceQuanTiTy ;
begin
end.
[Error] Project2.dpr(5): Undeclared identifier: 'ChoiceQuanTiTy'
Please correct for me. How to use a function in the same library
ASKER
Any other ways , if we do not consider on position ?
ASKER
IF do that, i already know .
Please show me the command to shutdow window. that command for shutdown depends on version of window ?
Or the command to close the active application on window.
Because i want comething to appear when they use my program but not register
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Position is everything. Another way, which gets more compliated still....
library aaaaa ;
uses
Unit1; //I can't be bothered to think of anything better.
begin
end;
unit Unit1;
interface
Function Total(X, Y: Integer): Integer; stdcall;
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall;
exports
Total,
ChoiceQuanTiTy;
implementation
Function Total(X, Y: Integer): Integer;
begin
x := ChoiceQuanTiTy(x,y) ;
Total := x + y ;
end;
Function ChoiceQuanTiTy(X, Y: Integer): Integer;
begin
if X < Y then ChoiceQuanTiTy := X else ChoiceQuanTiTy := Y;
end;
end.
I can't think of any more variations on this theme. geobul has already covered the others.
library aaaaa ;
uses
Unit1; //I can't be bothered to think of anything better.
begin
end;
unit Unit1;
interface
Function Total(X, Y: Integer): Integer; stdcall;
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall;
exports
Total,
ChoiceQuanTiTy;
implementation
Function Total(X, Y: Integer): Integer;
begin
x := ChoiceQuanTiTy(x,y) ;
Total := x + y ;
end;
Function ChoiceQuanTiTy(X, Y: Integer): Integer;
begin
if X < Y then ChoiceQuanTiTy := X else ChoiceQuanTiTy := Y;
end;
end.
I can't think of any more variations on this theme. geobul has already covered the others.
ASKER
both of answer are good. So how to send the point to both
ASKER
I can not see "Split Point"
Increase question points to 40 and split them. The minimum amount of points which can be assigned to an expert is 20.
Guys... Please use the Result varuable...
library aaaaa ;
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall; forward;
Function Total(X, Y: Integer): Integer; stdcall;
begin
x := ChoiceQuanTiTy(x,y) ;
RESULT := x + y ;
end;
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall;
begin
if X < Y then RESULT := X else RESULT := Y;
end;
exports Total, ChoiceQuanTiTy ;
begin
end.
Borland is different here from the Pascal standard simply because it's a bit more readable. If you use ChoiceQuanTiTy instead of Result, a reader might actually think you're calling the routine again, recursively...
To split points, you need to increase the points for this Q to 40 and split it. The minimum points any expert can get is 20 points. (But my remark is for free!)
library aaaaa ;
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall; forward;
Function Total(X, Y: Integer): Integer; stdcall;
begin
x := ChoiceQuanTiTy(x,y) ;
RESULT := x + y ;
end;
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall;
begin
if X < Y then RESULT := X else RESULT := Y;
end;
exports Total, ChoiceQuanTiTy ;
begin
end.
Borland is different here from the Pascal standard simply because it's a bit more readable. If you use ChoiceQuanTiTy instead of Result, a reader might actually think you're calling the routine again, recursively...
To split points, you need to increase the points for this Q to 40 and split it. The minimum points any expert can get is 20 points. (But my remark is for free!)
my remark was for free too. I decided not to point out the Result issue, so as not to confuse things.
ASKER
thank for all consider
-)
-)
Function ChoiceQuanTiTy(X, Y: Integer): Integer; stdcall;
begin
if X < Y then ChoiceQuanTiTy := X else ChoiceQuanTiTy := Y;
end;
Function Total(X, Y: Integer): Integer; stdcall;
begin
x := ChoiceQuanTiTy(x,y) ;
Total := x + y ;
end;
exports
Total,
ChoiceQuanTiTy ;
begin
end.
Regards, Geo