A Strange question with TSiLang5.2.5

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
weide
Posts: 3
Joined: Tue Aug 17, 2004 3:50 pm

A Strange question with TSiLang5.2.5

Post by weide »

I'm useing TSiLang5.2.5 with Delphi6.

My Project is work well,it has tens of forms and units with TSilang.All the tsilang is linked to siLangDispatcher on the DataModule.The End User can edit the .SIB file easily and can be loaded as run time.


But suddenly,a strange question happen,the Project can not load sib file at run-time:(

It has an exception :Access violation at address **** in module **.exe...

When I use Breakpoint,I find the question is at:

procedure TSIBFileManager.LoadFromStream(const AComp: TsiCustomLang; const
AOwnerClassName: string; AStream: TStream);

....

siClass := TComponentClass(GetClass(AComp.Classname));
SI := TsiCustomLang(siClass.Create(frm));//error here...
....

I find the siClass is nil ,so ...

Is this a question with tsilang? or my code error?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

This is strange and looks like in your application there somewhere made some class registration/unregistration routines. You can try detect by yourself the problem place or you may try to recreate step-by-step the project structure and check after what stage the error appears.
Hope this helps.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Also: the updating to most recent version (available now :!:) is recommended :wink:
weide
Posts: 3
Joined: Tue Aug 17, 2004 3:50 pm

Post by weide »

I have downloaded the 5.3.1,but not resove the question:(

What does "made some class registration/unregistration routines" mean?Could you give me some example?

Now,I am recreating step-by-step the project structure ...
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

weide wrote:What does "made some class registration/unregistration routines" mean?Could you give me some example?
When GetClass() returns nil this means that by some reason Delphi doesn't "know" the requested class.

Can you check what value returns the AComp.Classname ?
Wait! I have one idea:
May be you've created your SIB file from SIL? In such case please add siLngLnk to uses clause of your application units. Anyway, please check what AComp.Classname returns and be sure that your project knows about such class, in case not just add the respective unit from TsiLang folder to your uses clause.

Please let us know if this helps.
weide
Posts: 3
Joined: Tue Aug 17, 2004 3:50 pm

Post by weide »

To isiticov:
I think I have resolved the question.

1.AComp.Classname is TSilang,but getClass is nil
2.siLngLnk is no use...but when I use TSilangDispatcher in a dll,it is nessessary...I will say more later...
3.The answer to My question:For some reason,I used showmessage,and in my uses clause,I used 'QDialogs'---Just this reason.Replace with Dialogs.Every thing is OK! You can test it.But I think no other else use QDialogs maybe.


4.When used in DLL I define a Form in DLL,and I want to support mulilanguages too.But It seems no use.The Code I write like this:

Function fShowRoutineChartForTradex(AHandle:THandle;zltx:string;ChartType:integer; SmpSize:integer; RawData:array of double;usl,sl,lsl:double;bGiven:boolean;bUcl,bCL,bLcl:double;AComp:TComponent=nil):wordbool;
begin
result:=true;
application.Handle:=AHandle;
With TfrmGraph.Create(application) do
try
if AComp is TsiLangDispatcher then begin
siLang1.LangDispatcher:=TsiLangDispatcher(AComp);
TsiLangDispatcher(AComp).LoadAllFromFile(TsiLangDispatcher(AComp).FileName);
end;
ShowModal
finally
Free;
end;
end;

The same code I use by source--I mean add the DLL source to my project ,It work well...

Is TSilang support DLL form and load from SIB file?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

if AComp is TsiLangDispatcher then begin
This will not work in DLL, because DLL and main executable has different RTTI spaces and such operands as

Code: Select all

IS, AS
won't work when passing/evaluating types and classes. You shall either use run-time packages or just pass ActiveLanguage and FileName to your init procedure of DLL and then use internal dispatcher for all tasks.
Post Reply