[Bug] Dynalibs treated case sensitive

forum.gupta.bugreport (2005-2010)
Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Posts: 3390
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

[Bug] Dynalibs treated case sensitive

Post by Dave Rabelink » 20 Jan 2006, 00:45

 Posted by:  Dave Rabelink 

I have discovered a bug with dynalibs which i could not reproduce for
quite some time but now i have found it.

Sometimes a strange thing occurred. When a dynalib was initialised
with data and could be used by other dynalibs some of them actually
could get data from it, but others not. It seemed the initialised
dynalib suddenly cleared it's data as if it was not previously
initialised. I could not get a grip on the fact that within the
application some dynalibs could use the data as expected and at the
same time others could not. A workaround was to reshuffle the included
libraries and dynalibs within the sources (change the sequence of
including) which in most cases solved the problem.

After another strange issue with this i wanted to find what causes the

The reason for failure is a surprise for me :

Dynalib include declarations are CASE SENSITIVE !!

Let me explain.

Imagine there are two dynalibs and a main executable


Dynalib2.apd uses functionality/data from Dynalib1.apd and also
Main.exe uses this functionality directly from Dynalib1.apd.

The include declarations are :



Main calls Dynalib1.apd to initialise some global data, so
Dynalib1.apd holds data to be read. With an exported function of
Dynalib1 the data can be shown.

Dynalib2.apd also uses Dynalib1.apd. It wants to read the data from it
which is previously initialised by Main.

Normally this works ok. The data in Dynalib1 is initialised and both
Main and Dynalib2 can use it.
There is only one instance of Dynalib1 running, it holds the data
shared between Main and Dynalib2.

Surprisingly, if the declaration of the dynalib include in Main or
Dynalib2 does not correspond to eachother case wise, problems occur.

The next list of includes will reproduce the annoying bug :



The only thing which was changed is that Dynalib2 now includes
dynalib1.apd instead of Dynalib1.apd (the first character is
lowercase). It does not matter if the filename of the dynalib itself
has different upper or lower case characters, i'm talking about the
way the filename of the dynalib is entered in the include section.

So, when there are differences in how the dynalib filename is entered
in the several sources within your application using dynalibs they
will not work properly.

My theory is this :
Normally a dynalib should be loaded just once. There should be only
once instance of the dynalib loaded so other dynalibs access the same

But at runtime, the name of the dynalib is used as a kind of label to
identify the dynalib.

So when Main.exe calls Dynalib1 in de above example, it will load
Dynalib1 and lables it as "Dynalib1.apd", as entered in the include
Now, when later on Dynalib2 calls Dynalib1, it uses the label which is
entered in it's include section for the file and that is

TD checks at runtime when Dynalib2 calls Dynalib1 if the dynalib with
the label "dynalib1.apd" was already loaded. Seems TD checks the
labels using CASE SENSITIVITY. It can not find the label as given and
loads Dynalib1. At that time there are two copies of Dynalib1 running
at the same time.

Main uses copy 1, Dynalib2 uses copy 2. That is the reason why Main
can read the initialised data from Dynalib1 without problems (Main has
loaded Dynalib1.apd itself and labeled it as "Dynalib1.apd". But
Dynalib2 uses not the same dynalib Main has started before, it has
loaded another one which is obviously not initialised. Therefore that
copy 2 will have no data.

I have made a simple sample to reproduce this bug. Try it to see that
the dynalib includes are case sensitive and causes the strange

This should not happen. Files are case insensitive in Windows. It
should not matter if i include DYNALIB1.apd or dyNaLiB1.ApD. It is the
same file and at designtime it treats it also as the same file. At
runtime TD actually does take the case into account.

I have supplied a ZIP file with the sample. Read the text file for

Please try the sample and see in which versions this bug occurs.
The sample is created in TD3.1 PTF3, saved as text format.

Happily now i have found the reason for many strange issues with
vanishing data and other related effects using dynalibs.

Please confirm this can be reproduced as a bug at your setup and TD

I have logged it as a bug, in a few days we will see what Gupta says
of this.


Dave Rabelink

You do not have the required permissions to view the files attached to this post.


Re: [Bug] Dynalibs treated case sensitive

Post by Gregor » 20 Jan 2006, 10:45

 Posted by:  Gregor 

it is really a dirty trick, using global variables in a dynalib as global
variables for your main.exe ;-) But why not ... And you are right, it seems
to be case sensitive. I have to smile, because I never had this idea. If you
are using an instance variable of a class in base.apt instead of your global
variable gsdata it works.
So change your function SetData to
Set MyClass.MyData = psData

But as we know, using classes in TD can produce new problems ...

Have a nice day


Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Posts: 3390
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: [Bug] Dynalibs treated case sensitive

Post by Dave Rabelink » 20 Jan 2006, 22:31

 Posted by:  Dave Rabelink 

It is not true the global variable in the dynalib is used as global
variable in Main. It is not exported, so it is purely a global
variable within the dynalib only. Main does not see or access the
variable. It is completely hidden from it, as a blackbox normally
should do. The only way Main could access it is trough using an
exported function which does the accessing for you. This is normal
modular design and defenitely not a dirty trick !

Just like COM components, they could contain global variables
(attributes) but are only used within the COM object. Clients who use
that component can not access it, only through methods which are part
of the external interface.

The sample i provided is just a way to show the case sensitive bug.
I could easily have chosen not to use global variables, but instead
creating a form window and set a form window variable to store the
data. The case sensitive bug will show also when using top level
windows there are actually two instances of the dynalib loaded, which
results in creating 2 form windows with their own set of data stored.

Here a quote from the Gupta help document about dynalibs :

"A dynalib can use objects or call functions in another dynalib.
This feature makes it possible for an application to indirectly use
the same dynalib more than once. If this happens, Gupta SQLWindows
loads only one instance of the dynalib and its global variables. For
example, an application uses dynalib1 and dynalib2. Dynalib2 also uses
dynalib1. The first time the application or dynalib2 refers to
dynalib1, Gupta SQLWindows loads one instance of it."

The last line is not true when using mixed case characters in your
dynalib include declaration.



Re: [Bug] Dynalibs treated case sensitive

Post by Gregor » 21 Jan 2006, 08:25

 Posted by:  Gregor 

For me this idea of keeping variables in a dynalib was new. I never had the
idea in all the years. I was always using class variables an now I have the
known problems. I hope you have remarked, that I was writing "dirty" with a
smile ;-).


Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Posts: 3390
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: [Bug] Dynalibs treated case sensitive

Post by Dave Rabelink » 21 Jan 2006, 12:33

 Posted by:  Dave Rabelink 

I understand ;-)

When i started with dynalibs years ago when it was first released as
feature i could not imagine the strength of it. Like many others i
could not see the potential usefulness about precompiled libraries.
Mainly because in TD you normally think about source libraries which
are used at designtime.

But i have learned that dynalibs are the best solution to make
applications modular and the dynalib feature is IMHO the best
invention Gupta has added to TD next to the outline editor.

It is only a shame that Gupta does not see it themselves. They do not
promote it in any way and their bugfixing is minimal. The problems
with dynalibs keep developers from using it. And that is a really
shame !

Over the years i have found workarounds for allmost all bugs
encountered and dynalibs work here 100%. But the issues and
workarounds must be completely implemented.

This new issue just adds up to the list of OFFICIALLY registered bugs.
Some of them are still not fixed and keep coming back to new TD
versions. Gupta should make effort in fixing these bugs and not only
linking a defectnumber to it.

So i ask the community here to test the issue described in this thread
with TD versions higher than 3.1. Is the bug still present there ?


Igor Ivanovic
Site Admin
Site Admin
Posts: 1462
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: [Bug] Dynalibs treated case sensitive

Post by Igor Ivanovic » 21 Jan 2006, 22:14

 Posted by:  Igor Ivanovic 


The bug is still present in TD2005.1!!!
One of those that keep their presence for years now.
That's one of the main reasons we only occasionally use dynalibs!
Never had the time to find workarounds like you did.
And what will be with dynalibs when TD2006 will be out?


Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Posts: 3390
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: [Bug] Dynalibs treated case sensitive

Post by Dave Rabelink » 21 Jan 2006, 23:02

 Posted by:  Dave Rabelink 

On Sat, 21 Jan 2006 22:14:03 +0100, Igor Ivanovic

Thanks Igor, for the info !!!

I probably will get the defect number in a few days from Gupta and i
will report it here.

Posts: 280
Joined: 07 Jun 2018, 15:13
Location: Stuttgart, GER

Re: [Bug] Dynalibs treated case sensitive

Post by michael » 23 Jan 2006, 13:47

 Posted by:  Michael Hummel 

hello Dave,

TD 4.1 PTF1 still bug (base.apd not the same as Base.apd).


Return to “gupta.bugreport”

Who is online

Users browsing this forum: [Ccbot] and 0 guests