🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
5 messages
5 total messages Started by Jim Melsom Wed, 15 Aug 2001 21:53
TClientDataSet::LoadFromFile fails ??
#478
Author: Jim Melsom
Date: Wed, 15 Aug 2001 21:53
29 lines
1976 bytes
TClientDataSet::LoadFromFile

When a TClientDataSet component is constructed by a runtime BPL, the
LoadFromFile and LoadFromStream methods fail.  When the BPL is
statically linked, the methods work. The same thing happens if you
derive a new component from TClientDataSet and create an instance in
code or drop it on a form. When dropped on a form, the IDE is able to
set the Active peorpty to true, but the program cannot.

Is this a known problem?  Does anyone know the reason for it?


Example: If a BPL contains an exported function like the following 
(inside or outside a class, it doesn't make any difference):

declaration:  
TClientDataSet* _export CreateDS(TComponent* Owner);

implementation: 
TClientDataSet* CreateDS(TComponent* Owner) { return new
TClientDataSet(Owner); };

An application that dynamically links this BPL will fail if it tries to
do the following:

TClientDataSet* ds = CreateDS(this);
ds->LoadFromFile(aValidDatasetFile);

 If the BPL is statically linked, the function works.
Re: TClientDataSet::LoadFromFile fails ??
#482
Author: Mark Cashman
Date: Mon, 20 Aug 2001 11:51
13 lines
1436 bytes
Hi, Jim!

Could there be anything wrong with the loaded Client DS? Perhaps it
needs a database that doesn't exist when it is loaded?

------
Mark Cashman (TeamB - C++ Builder), creator of The Temporal Doorway at
http://www.temporaldoorway.com
- Original digital art, writing, music and more -
C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
(Join us!)
http://www.temporaldoorway.com/programming/index.htm
------
Re: TClientDataSet::LoadFromFile fails ??
#483
Author: Jim Melsom
Date: Wed, 22 Aug 2001 04:23
15 lines
1633 bytes
Mark Cashman wrote:
> Could there be anything wrong with the loaded Client DS? Perhaps it
> needs a database that doesn't exist when it is loaded?

I don't think so in this case. The dataset has no references to any
other tables or databases, and the test file I'm using can be loaded
from disk and displayed in say a dbgrid as long as the TClientDataSet is
constructed in the main program. The same file can't be loaded if the
TClientDataSet is constructed in a dynamically-linked component library.

I found that I can still use other run-time packages in a project, as
long as the one that's causing the problem is statically linked by
adding its .lib file to the project.

The exception occurs in ntdll.dll.
Re: TClientDataSet::LoadFromFile fails ??
#485
Author: Mark Cashman
Date: Fri, 24 Aug 2001 11:27
16 lines
1689 bytes
My intuition says that this is probably related to the TApplication
object.

In a package, all package users are supposed to share a TApplication.
Make sure that the DLL and the main program are both using run time
packages and have dynamic run time library as their link option. That
should ensure that all are using the same TApplication at run time.

------
Mark Cashman (TeamB - C++ Builder), creator of The Temporal Doorway at
http://www.temporaldoorway.com
- Original digital art, writing, music and more -
C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
(Join us!)
http://www.temporaldoorway.com/programming/index.htm
------
Re: TClientDataSet::LoadFromFile fails ??
#487
Author: Jim Melsom
Date: Sun, 26 Aug 2001 18:12
10 lines
1556 bytes
Mark Cashman wrote:
> My intuition says that this is probably related to the TApplication
> object.
> In a package, all package users are supposed to share a TApplication.
> Make sure that the DLL and the main program are both using run time
> packages and have dynamic run time library as their link option. That
> should ensure that all are using the same TApplication at run time.

Thanks Mark. I don't have time to chase this any more right now but I'll
keep that in mind if I get back to it.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads