You are not logged in.
Pages: 1
sorry for the topic not related to mORMot.
i have a server with mORMot using Delphi 10.3.3 under Windwos Server for years , thanks for ab and the great team.
i create another server also with mORMot using Lazaris 1.9.0. under CentOS 7, i put TDataModule in DLL, it raised exception,
"Failed to initialize component class "TDataModule1": No streaming method available."
here is the code:
library mydll;
{$mode objfpc}{$H+}
Uses
fastMM4,
{$IFDEF UNIX}
cthreads,
{$ENDIF}
classes, Sysutils, lcl;
type
TDataModule1 = class(TDataModule)
private
public
end;
var
sl:TStringlist;
DataModule1: TDataModule1;
begin
sl:=TStringlist.Create;
try
DataModule1:= TDataModule1.create(nil); <--error
except on e:exception do begin
sl.Add('2:' + e.Message);
sl.SaveToFile('c:\sl.txt');
end;
end;
DataModule1.free;
sl.free;
end.
thanks for help.
Offline
I suspect this is more a question for Lazarus/FPC than for mORMot.
To be honnest, I never used a TDataModule with FPC.
And mORMot is source-first, so you don't need TDataModule or any non-visual component.
Online
Yes, it is a tiresome question about Lazarus/FPC, and i manage to avoid using TDataModule.
Is there any alternative? I have some components and predefined functions/procedures in it.
thanks.
Offline
Try this, perhaps it helps.
TDataModule1.CreateNew(nil);
Offline
@AOG, thanks, it seems to be ok. and i will practice it in my project and reply the message later.
Offline
@ab, AOG:
yes, mORMot is source-first, so i gave up TDataModule and with fpcunit.TTestCase instead, it works.
many thanks!
Offline
i got the linking error as follow when built the shared library, and it worked correct if i bulit the executive program directly.
Verbose: linker: /usr/bin/ld: mORMot/static/x86_64-linux/sqlite3.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
Verbose: linker: /usr/bin/ld: mORMot/static/x86_64-linux/ecclin64O2.o: relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC
thanks!
Offline
Put -Cg- in the project options.
Or try -Cg (without trailing -) also ... ;-)
Offline
-Cg is the same as -fPIC,
i got the same error message with -Cg- in the custom options.
Offline
is it possible that static/x86_64-linux/sqlite3.o and static/x86_64-linux/ecclin64O2.o should be compiled with -fPIC option?
thanks!
Offline
@ab, thanks, and I will try later.
Offline
@ab, AOG:
after recompiled sqlite3.c and ecc.c with -fPIC option, it worked.
thanks to both of you!
Offline
That is good to know. Thanks.
On Android, this is already standard.
Offline
Pages: 1