Page 1 of 1

CallFunction with PB4.40

Posted: Mon Dec 14, 2009 6:16 pm
by Karbon
I don't know if this is a bug but it's certainly something that worked before 4.40

---------------------------
PureBasic
---------------------------
Line 6701: Bad parameter type, number expected instead of string.
---------------------------
OK
---------------------------

That's from a CallCFunction() call.

I see this in the changelog : " Changed: Call(C)Function(Fast) parameters have been changed from 'Any' to 'Integer'."\

What does that mean exactly? The documentation is exactly the same as far as I can tell. The function(s) I'm calling needs a string parameter passed in.

Re: CallFunction with PB4.40

Posted: Mon Dec 14, 2009 6:18 pm
by ts-soft
use @mystring.s or @"bla"
or better, don't use callfunction, use prototypes :wink:

Re: CallFunction with PB4.40

Posted: Mon Dec 14, 2009 6:25 pm
by Karbon
I try not to fix things that aren't (or weren't) broken ;-)

Guess I'll be switching. Kind of wish this was documented!

Re: CallFunction with PB4.40

Posted: Mon Dec 14, 2009 6:36 pm
by SFSxOI
Did you try pointers with it?

Re: CallFunction with PB4.40

Posted: Mon Dec 14, 2009 6:42 pm
by Karbon
Pointers it was!

Re: CallFunction with PB4.40

Posted: Mon Dec 14, 2009 7:39 pm
by blueznl
Many of us posted this as a bug or a question, myself included :-) It was in the list of changes IIRC though... :oops:

Re: CallFunction with PB4.40

Posted: Mon Dec 14, 2009 7:40 pm
by ts-soft
ts-soft wrote:use @mystring.s or @"bla"
this a pointers with the @, i think my english is to bad :wink:

Re: CallFunction with PB4.40

Posted: Tue Dec 15, 2009 11:01 pm
by Marco2007
ts-soft wrote:use @mystring.s or @"bla"
or better, don't use callfunction, use prototypes :wink:
Thomas, I use the @-thing....why is better to use prototypes? Any problems with the @-thing?

Re: CallFunction with PB4.40

Posted: Wed Dec 16, 2009 2:27 pm
by Seldon
OK, but couldn't our PB compiler make it for us ? I mean when we pass a string to a DLL, it passes the pointer instead (like it has been so far). It's BASIC after all. Maybe, are there any other problems ?

Re: CallFunction with PB4.40

Posted: Wed Dec 16, 2009 2:47 pm
by moogle
Marco2007 wrote:why is better to use prototypes?
Because I think then you can call the function name directly in your code once you set up the prototype correctly, instead of CallFunctionFast() etc, etc.