New Blog Post: PDF/A and Metadata

DataSource through procedure's parameter

edited July 2001 in General
Hi,
How can I pass TDataSource through procedure call.
I have DataSource1.DataSet1 created dynamically in the main application.
Now I need to print the result by calling ppReport1 in dll.
eg.
..after GetProcAddress...
PrintResult(DataSource1)

...in dll
procedure PrintResult(Data: TDataSource)
begin
{ With Data do
begin
While not Dataset.Eof do
begin
ShowMessage(DataSet.FieldByName('Field1').AsString);
Next;
end;
end; debug purposes }
ppPipeLine.DataSource:= Data;
ppReport1.PrintReport;
end;
the Preview shows halfway and my apps crash.
I have no problem showing message for all the records(comment off debug
mode)
Please advise, how can I achive this.

TIA.
Hott

Comments

  • edited July 2001
    Hi Hott...

    Yo can try two things to solve this problem: a) Add the Borland
    Memory Manager to your DLL and host application (as very first
    statement in the uses clause) and b) compile your application with
    run-time packages.

    You are passing a object into your DLL, this means that they are
    not type compatible as the DLL uses different RTTI information
    set as your host application. The compiler might not include some
    methods of the object which are not used in your DLL by itself,
    but might be used when you pass in the object. This might cause
    your AV.

    If you use run-time packages the TDataSource is in the package
    and has only one set of RTTI information for both.

    Hope that helps...
    -------------------------------------------------------------------
    Marco Heine
    QUMAS
    Enterprise Compliance Management
    Visit our Website: www.qumas.com




This discussion has been closed.