Tailbite bug ??

Everything else that doesn't fall into one of the other PB categories.
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Tailbite bug ??

Post by Droopy »

When I run this code it works

Code: Select all

ProcedureDLL.s GetProgramName2()
  ProgramName.s=Space(255)
  GetModuleFileName_(0,@ProgramName,255) 
  ProcedureReturn GetFilePart(ProgramName)
EndProcedure

ProcedureDLL.s GetProgramPath2()
  ProgramName.s=Space(255)
  GetModuleFileName_(0,@ProgramName,255) 
  ProcedureReturn GetPathPart(ProgramName)
EndProcedure

test with :

Code: Select all

Debug GetProgramPath2() + GetProgramName2()
but when I create a Library with Tailbite the result show only the result of the first procedure.

I don't know why .
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: Tailbite bug ??

Post by traumatic »

Maybe this has something todo with var-arg-functions?
tailbite docs wrote: You can make your function accept variable arguments. To do so, you must include two or more ProcedureDLL's with the same name and an index number:

Code: Select all

   ProcedureDLL MyFunction(arg1, arg2)
     result = Pow(arg1, arg2)
     ProcedureReturn result
   EndProcedure

   ProcedureDLL MyFunction2(arg1, arg2, arg3)
     result = Pow(arg1, arg2)/arg3
     ProcedureReturn result
   EndProcedure
tailbite docs wrote: To be considered as different versions of the same function with different argument number, the arguments names and types must coincide between them; otherwise, both functions will be considered different functions and processed that way.

After the library is made, and the compiler restarted from the PureBasic editor, if you type MyFunction( in the PureBasic editor, the status window will show:

Code: Select all

MyFunction (arg1, arg2 [, arg3])
tailbite docs wrote: And you'll be able to call the function with two or three arguments. You can make as many versions as you want, with a different number of arguments, as long as you follow the mentioned rules.
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Post by Droopy »

Sorry I changed the procedure name to avoid conflict with my lib ( add a 2 after the procedure name )

With the original name the problem is the same ( Ok when running / False with Tailbite )

Code: Select all

ProcedureDLL.s GetProgramName() 
  ProgramName.s=Space(255) 
  GetModuleFileName_(0,@ProgramName,255) 
  ProcedureReturn GetFilePart(ProgramName) 
EndProcedure 

ProcedureDLL.s GetProgramPath() 
  ProgramName.s=Space(255) 
  GetModuleFileName_(0,@ProgramName,255) 
  ProcedureReturn GetPathPart(ProgramName) 
EndProcedure
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Well, it was just quick shot... it's not that I'm using Tailbite on a regular basis ;)

Seems like there's a problem with returning strings then...
Is it possible to return strings at all?
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Post by Droopy »

Yes it can return string

when you test with :

Code: Select all

Debug GetProgramPath() ; No problem
debug GetProgramName() ; No problem
Debug GetProgramPath() + GetProgramName()  ; Problem only with Tailbite !?
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Yes, it's TailBite, this return string problem. As long as it's not fixed, I suggest to not use them, that is, like when you code a DLL.

I hope I'll fix this, some time in the near future, when I have some real time to dedicate to other stuff than work :(

EDIT:I'll give it another try tomorrow.
El_Choni
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Post by Droopy »

Everything OK with Tailbite 1.2 Pr1 !!

Thanks a lot
Post Reply