Board index » cppbuilder » Package problems

Package problems


2004-10-05 06:13:44 PM
cppbuilder15
Hello,
Another problem we are now encountering has to do with multiple
packages. Instead of using libraries, a program can also be a
compilation of packages. Up to now we only used three packages, and
never had a prblem with them. But these packages were becomming so big
that they needed to be split up into several smaller ones with each
containing sources of the same kind, e.g. one package for dealing with
only graphics, and another package for memory handling, including file
management.
Two of the three packages have been split up in to seven smaller ones.
One contains a static object, that has a constructor that is called once
at the start of the program. This object defines a linked list, that
assigns a directory path to a unique name, an alias. Throughout the
program we can then use this alias to change to a directory. This list
is filled from an ASCII configuration file. We can modify directories in
the configuration file, and still have a working program without
recompiling it.
The problem arises when we want to store or retrieve aliases from within
different packages. The static object seems to move all over the place.
I mean this exactly. When debugging our code, and specifically looking
at the <this>pointer of the object, it's value changes all the time,
but it's contents will be lost. The contents is only correct when the
right value for the <this>pointer comes around. We have functions to
set or get the contents of this list object. These functions are used
throughout the packages and program. The call origin of these functions
seem to determine the value of the object's address (and thus the this
pointer of it). When the call originates from a source in the executable
everything works fine, but when the call originates from a source inside
a sub package, the executable is using, then the list object is
momentarily lost. The program doesn't crash, simply doesn't do what it
supposed to do.
Can anyone help me solve this problem?
Wiljo.
 
 

Re:Package problems

Hi,
Quote
Another problem we are now encountering has to do with multiple
packages. Instead of using libraries, a program can also be a
A couple of ideas: the first BCB6 patch addressed problems with
packages refering to types from other packages so make sure all
patches are applied. Make sure that the splitting up process
you did, did not result in a unit that does not have the
#pragma package(smart_init) directive.
--Craig
 

Re:Package problems

Craig Farrell wrote:
Quote
Hi,

>Another problem we are now encountering has to do with multiple
>packages. Instead of using libraries, a program can also be a


A couple of ideas: the first BCB6 patch addressed problems with
packages refering to types from other packages so make sure all
patches are applied. Make sure that the splitting up process
you did, did not result in a unit that does not have the
#pragma package(smart_init) directive.

--Craig

Thanks,
But this is not the solution to my problem. BCB6 Patch 4 has been
installed, and every package source file contains the "#pragma ..."
directive described above. If some files do not, you would get strange
linker errors in other packages or executables. The packages and
programs compile completely without any warning or error messages. The
problem occurs at run time, but you need to debug the program to see why
it does do what it is supposed to do. It is very strange to see the
<this>pointer of the same object change it's value all the time.
Meanwhile I have reverted back to a backup of the packages of a week ago
and I am currently splitting them up again step by step, and ensuring
myself that after each step the programs still work.
Wiljo.
 

{smallsort}