Duplicate Name Definition with FF_INI_GetKey

Started by philipstorry, March 20, 2005, 01:57:56 PM

Previous topic - Next topic

philipstorry

Platform: Firefly 1.10, PB/Windows 7.04, Latest (Jan 27th) WinAPI includes, Windows XP Professional SP2.

Problem: I added a slew of functions to my app which interrogate an INI file. All was well before this, but afterwards no luck - FireFly reports the following:

The PowerBasic Compiler returned an error during compiling:

Error Number = 466
Error Description = Duplicate name definition
Function FF_INI_GetKey (ByVal IniFile As String, ByVal lSection As String, ByVal lKey As String, ByVal lDefault As String) As String

Naturally, being new to FireFly, I concluded I had done something wrong. (I'm normally in JellyFish Pro, writing console apps. FireFly is new to me, but as I'm familiar with JellyFish/Lynx/PowerBasic the balance of probability - and prior experience - told me that I'd probably done something wrong! :D)

Feeling stupid, I began an investigation of my own code, which gained me nothing except a realisation I'd have to re-write it all some day when I've learnt more.
I moved on, in desperation, to looking at the outputted code - which leads me to believe that FireFly is putting a duplicate definition in for this subroutine when it compiles the project. Here's the results of a FFIND (a file/text search) from Take Command/32:

[C:\projects\NotesCleardown\Output]ffind /t"FF_INI_KeyExists" /V /L *.*

---- C:\projects\NotesCleardown\Output\NotesCleardown_CHECKNOTESLOCATIONROUTINESINC_MODULE.inc
[77]            If FF_INI_KeyExists(IniFileToUse, "[Notes]", "Location") > 1 Then
[89]            If FF_INI_KeyExists(IniFileToUse, "[Notes]", "mailserver") > 1 Then
[95]            If FF_INI_KeyExists(IniFileToUse, "[Notes]", "mailfile") > 1 Then
[101]           If FF_INI_KeyExists(IniFileToUse, "[Notes]", "keyfilename") > 1 Then
[134]                   If FF_INI_KeyExists(IniFileToUse, "[Notes]", "Location") %TRUE Then
[156]           If FF_INI_KeyExists(IniFileToUse, "[Notes]", "mailserver") = %TRUE Then
[172]           If FF_INI_KeyExists(IniFileToUse, "[Notes]", "mailfile") = %TRUE Then
[188]           If FF_INI_KeyExists(IniFileToUse, "[Notes]", "keyfilename") = %TRUE Then

---- C:\projects\NotesCleardown\Output\NotesCleardown_DECLARES.inc
[85] Declare Function FF_INI_KeyExists(ByVal IniFile As String, ByVal lSection As String, ByVal lKey As String) As Long

---- C:\projects\NotesCleardown\Output\NotesCleardown_UTILITY.inc
[207] Function FF_INI_KeyExists(ByVal IniFile As String, ByVal lSection As String, ByVal lKey As String) As Long
[247] '//FF_INI_KeyExists//  

 11 lines in      3 files

[C:\projects\NotesCleardown\Output]ffind /t"FF_INI_GetKey" /V /L *.*  

---- C:\projects\NotesCleardown\Output\NotesCleardown_CHECKNOTESLOCATIONROUTINESINC_MODULE.inc
[78]                    location = FF_INI_GetKey(IniFileToUse, "[Notes]", "Location", "")
[90]                    mailserver = FF_INI_GetKey(IniFileToUse, "[Notes]", "mailserver", "")
[96]                    mailfile = FF_INI_GetKey(IniFileToUse, "[Notes]", "mailfile", "")
[102]                   idfile = FF_INI_GetKey(IniFileToUse, "[Notes]", "keyfilename", "")
[135]                           location = FF_INI_GetKey(IniFileToUse, "[Notes]", "Location", "")
[157]                   mailserver = FF_INI_GetKey(IniFileToUse, "[Notes]", "mailserver", "")
[173]                   maildatabase = FF_INI_GetKey(IniFileToUse, "[Notes]", "mailfile", "")
[189]                   idfile = FF_INI_GetKey(IniFileToUse, "[Notes]", "keyfilename", "")

---- C:\projects\NotesCleardown\Output\NotesCleardown_DECLARES.inc
[88] Declare Function FF_INI_GetKey (ByVal IniFile As String, ByVal lSection As String, ByVal lKey As String, ByVal lDefault As String) A
s String
[324] Declare Function FF_INI_GetKey (ByVal IniFile As String, ByVal lSection As String, ByVal lKey As String, ByVal lDefault As String)
As String

---- C:\projects\NotesCleardown\Output\NotesCleardown_UTILITY.inc
[281] '//FF_INI_GETKEY//
[287] Function FF_INI_GetKey (ByVal IniFile As String, ByVal lSection As String, ByVal lKey As String, ByVal lDefault As String) As Strin
g
[293] '//FF_INI_GETKEY//
[4537] Function FF_INI_GetKey (ByVal IniFile As String, ByVal lSection As String, ByVal lKey As String, ByVal lDefault As String) As Stri
ng

 14 lines in      3 files


Note that FF_INI_KeyExists appears only once in NotesCleardown_DECLARES.INC and _UTILITY.INC, despite being called multiple times - whereas FF_INI_GetKey appears in them twice.

I have no idea WHY it's putting that function in twice, but I can't seem to make it stop doing it. Very odd.
I can supply you the project if you like, but it's spectacularly mundane stuff, and you're already seeing every line that the function is mentioned on in the FFIND results above...

(And as an aside, I looked in the _UTILITY.INC file and I already suspect I'm using square brackets for denoting sections in the FF_INI_ calls when I don't need to. But I'll cross that bridge after it compiles and fails to find anything... If that is the case, I might ask for it to be spelt out in the help file a little more clearly though! :wink: )

Any ideas?

TechSupport

I am checking into this right now.... hopefully, I will have an answer for you soon.

TechSupport

Hi Philip,

Download the following file, unzip the one file into the FireFly directory. It should replace an existing file.

Re-compile your application. Does it fix the problem???? If not, please email me the "_DECLARES" and "_UTILITY" files.

Good luck!  :)

philipstorry

Paul,

Thanks for the quick reply! And on a Sunday too!

Quote from: TechSupportDownload the following file, unzip the one file into the FireFly directory. It should replace an existing file.

Just one thing... What file? I've tried both Opera and Firefox, and can't see anything attached...

Or am I being premature and impatient? If so, please accept my apologies! :D

Philip

TechSupport


philipstorry

Thanks, Paul - That's fixed it!

:D :D :D