String pointer wrong parameter type?

TailBite specific forum

Moderators: gnozal, ABBKlaus, lexvictory

Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

String pointer wrong parameter type?

Post by Mistrel »

This works in PureBasic but as a TailBite library it's classified as "Bad parameter type: a string is expected.".

Code: Select all

ProcedureDLL TB_Test(*String.s)
  Debug *String.s
EndProcedure

TB_Test(@"Hello!")
User avatar
helpy
Enthusiast
Enthusiast
Posts: 552
Joined: Sat Jun 28, 2003 12:01 am

Re: String pointer wrong parameter type?

Post by helpy »

Sorry! Originally I wrote in german! Here the translation:

According to the error message "*String.s" in the procedure declaration is interpreted as string (not as pointer) ... that means: the routine expects a string, but @"Hello!" is a pointer!

Try this:

Code: Select all

ProcedureDLL TB_Test(*pString.String)
  Debug "Pointer: " + Str( *pString )
  Debug "String: " + *pString\s
EndProcedure

TB_Test(@"Hello!")
The combination of pointer "*" and datatype ".s" should never be used!
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Re: String pointer wrong parameter type?

Post by lexvictory »

@Mistrel: wasn't it discussed in one of your bug reports that a pointer with .s at the end doesn't make sense? (I'm not sure I kept reading the posts)

TB looks at the suffix (.s in this case) and uses that. Pointers would be caught in the default case.

Code: Select all

Select rv$
  Case "b":
    ImportFunction()\RetValue$ = "Byte"
  Case "w":
    ImportFunction()\RetValue$ = "Word"
  Case "l":
    ImportFunction()\RetValue$ = "Long"
  Case "f":
    ImportFunction()\RetValue$ = "Float"
  Case "q":
    ImportFunction()\RetValue$ = "Quad"
  Case "d":
    ImportFunction()\RetValue$ = "Double"
  Case "s":
    ImportFunction()\RetValue$ = "String"
  Default
    ImportFunction()\RetValue$ = "Long"
EndSelect
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: String pointer wrong parameter type?

Post by Mistrel »

lexvictory wrote:@Mistrel: wasn't it discussed in one of your bug reports that a pointer with .s at the end doesn't make sense? (I'm not sure I kept reading the posts)
I made a very long post about this but it seems to have disappeared. My post is simply in regards to unexpected functionality. It's not mirroring the same behavior as PureBasic, which is unexpected.
Post Reply