[fpc-devel]Is these bags ?
Lihach at newmail.ru
Lihach at newmail.ru
Tue May 14 09:26:27 CEST 2002
I"ve a shared library using Free Pascal version 1.0.6
for Linux Red Hat 7.2 ( see shared_fp.pp below).
Two similar programs one writen in c (hello_c.c) the other
in Free Pascal
(hello_fp.pp) use of this library.
I expect the results to be the same, but they are
different. Why ?
Please answer if possible.
Best regards Lihachev Vladimir.
Lihach at newmail.ru
LVlad at rambler.ru
========= {file shared_fp.pp} ============
library shared_fp;
uses unit1;
exports
myfunc;
end.
-------- {file unit1} -----------------
unit unit1;
interface
function myfunc: PChar; cdecl; export;
implementation
uses Linux, Crt;
function myfunc: PChar; cdecl; export;
var PCHour, PCMin, PCSec, PCMSec: Word;
begin
GetTime(PCHour, PCMin, PCSec, PCMSec);
writeln("PCHour=", PCHour);
result:="Hello Word FPC";
end;
initialization
writeln("initialization");
finalization
writeln("finalization");
end.
=========================================
========={file hello_c.c} ===============
extern const char *myfunc();
int main(void)
{
printf("%s\n", myfunc());
return 0;
}
=========={ file hello_fp.pp} ===========
function myfunc: PChar; cdecl; external "libshared_fp.so";
begin
writeln(myfunc);
end.
=========================================
Results of the program hello_c.c:
==================================
initialization
PCHour=9
Hello Word FPC
finalization
==================================
Results of the program hello_fp.pp:
==================================
PCHour=5
Hello Word FPC
==================================
__________
www.newmail.ru -- всегда что-то новое.
More information about the fpc-devel
mailing list