Page 1 of 1

Ignore string parameter type for external functions

Posted: Wed Nov 19, 2014 7:09 pm
by PureGuy
Default included Win32 API accept both variable types pointers or PB's strings variables.
But it's not possible to declare imports of prototypes that way.

Code: Select all

MessageBox_(0, @"Text", @"Caption" , 0) ; works
MessageBox_(0, "Text", "Caption" , 0)   ; works

Import ""
  MessageBoxW(a,b,c,d)
EndImport

MessageBoxW(0, @"Text", @"Caption" , 0) ; works
MessageBoxW(0, "Text", "Caption" , 0)   ; seriously?
This restriction doesn't make any sense and PB should really handle this.

Re: Ignore string parameter type for external functions

Posted: Wed Nov 19, 2014 7:46 pm
by ts-soft
The MessageBox_ uses the any-type. This is only supported by UserLib/Libs!

MessageBoxW uses integer-type. This can't handle text.

Re: Ignore string parameter type for external functions

Posted: Wed Nov 19, 2014 7:58 pm
by PureGuy
You missing the point.
The external function does not care if PB call it string, it just get the address in both cases.

The compiler should understand that and ignore this "error" by just send the address.

Re: Ignore string parameter type for external functions

Posted: Wed Nov 19, 2014 8:24 pm
by ts-soft
This is a bad idea. This was removed from CallFunction/CallFunctioFast ... to avoid problems.