Page 1 of 1

Import "some.lib"- and strings.

Posted: Wed Oct 02, 2013 5:55 pm
by jassing
Would this be feasible?
Import "Some.lib"
MyFunc.s( someparame.l, otherparam.s)
endimport

the ".s" signaling the return type from the function.
Yes, I know we can use openlib/getfunction/prototypes, but this would seem very easy, intuitive and, dare I say it, basic, to ease the import/coding.

Re: Import "some.lib"- and strings.

Posted: Wed Oct 02, 2013 6:46 pm
by Danilo
jassing wrote:Import "Some.lib"
MyFunc.s( someparame.l, otherparam.s)
endimport
I would like to add pseudotypes to this request:
Please allow pseudotypes for import functions and prototypes as return type.

Code: Select all

ImportC "Some.lib"
  MyFunc1.p-Ascii   ( arg.p-ascii   )
  MyFunc2.p-Unicode ( arg.p-Unicode )
  MyFunc3.p-utf8    ( arg.p-utf8    )
  MyFunc4.p-bstr    ( arg.p-bstr    )
EndImport

PrototypeC.p-ascii   C_func1()
PrototypeC.p-Unicode C_func2()
PrototypeC.p-utf8    C_func3()
PrototypeC.p-bstr    C_func4()
So PB could catch null-terminated C char* pointers and automatically convert it to PB string. In Ascii and Unicode mode.
In generated ASM, it would be only a call to an internal convert function, directly after calling the function. After that,
we have a PB string. char* = 0 would return an empty PB string.