July 20, 2024, 06:48:10 AM


Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........

Effect of duplicate dialog definition in project module

Started by AdrianFox, November 16, 2009, 12:30:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


More an observation than a question.

I'm building a multi-module project, most modules using windows rather than dialogs.  However, the module I've just added to the project uses a dialog box.
In changing it from a stand-alone bit to including it in the project, I forgot to remove the 'dialog d1' definition having already defined it as 'def d1:dialog' at the start.

When I forget to do this with a window, I get warned by the compiler of a 'duplicate definition'.  But with the dialog the program compiled with the error.
Bizarrely the only effect was for the module to run without proper formatting and not including any of the data from its 'include' file.  This made me go to look for other problems such as an error with the include file or the way I had linked to it, until I came across my duplicate definition.

Perhaps it may be possible in future versions for the compiler to warn when there is a duplicate dialog definition as it does with a window duplicate definition.
Adrian Fox

Ionic Wind Support Team

I can only guess since I don't have your code.  But if you were doing this:

file 1:
dialog d1

file 2:
def d1 as dialog

Then it isn't a duplicate variable, it is two separate file global variables. Meaning they are global to the file they are contained in, but not "seen" anywhere else in the project, and which one was getting used depends on which file you had the CreateDialog statement.  However If you would have made them project global:

file 1:
global dialog d1

file 2:
global d1
def d1 as dialog

Then you would have been given the duplicate name error from the linker.

For projects if you want to have shared variables between all of your source files please read up on the PROJECTGLOBAL keyword:


Which simplifies the management of project global variables by allowing you to include that file in every project file and only having the variables created once, instead of once per file object.


Ionic Wind Support Team