CarbonLib
CarbonLib
Hi,
I have some CarbonLib Functions in an another language i would like to translate and test in PB.
How do I declare the CarbonLib functions?
My code now is like this:
Declare Function ChangeWindowAttributes Lib "CarbonLib" (Window, setAttrib,clearAttrib) as integer
And then I call it:
err = ChangeWindowAttributes(Window, 251256, 0)
Thx,
SEO
I have some CarbonLib Functions in an another language i would like to translate and test in PB.
How do I declare the CarbonLib functions?
My code now is like this:
Declare Function ChangeWindowAttributes Lib "CarbonLib" (Window, setAttrib,clearAttrib) as integer
And then I call it:
err = ChangeWindowAttributes(Window, 251256, 0)
Thx,
SEO
You can do it with the 'pbsoimporter' executable found in the purebasic/compilers/ directory. I've uploaded a definition file here: http://www.purebasic.com/beta/mac/soimporter so you can modify it and add the missing calls. The number after the function name is the number of parameters. To create the definition file, use this:
Then, just add an '_' after the function name: ChangeWindowAttributes_(Window, 251256, 0)
The file created will be in purebasic/purelibraries/macos/ (you can rename it if needed).
I didn't find a list easy to parse of all Carbon API calls (there is a lot) so it's really incomplete for now. If you have an idea how generate it, feel free to tell me .
Code: Select all
pbsoimporter control.pbl /TO /Users/yourhome/yourdrawer/purebasic
The file created will be in purebasic/purelibraries/macos/ (you can rename it if needed).
I didn't find a list easy to parse of all Carbon API calls (there is a lot) so it's really incomplete for now. If you have an idea how generate it, feel free to tell me .
CarbonLib....
I get an Error msg: Line 12 ChangeWindowAttributes_() is not a function (or nor available in demo version), an array, or linked list.
I also tested without 'err'
Here is the .pbl file
Then I put the carbonx file in the macos folder together with control, core and so on....
Regards,
SEO
I get an Error msg: Line 12 ChangeWindowAttributes_() is not a function (or nor available in demo version), an array, or linked list.
Code: Select all
If OpenWindow(0, 100, 100, 195, 260, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")
err = ChangeWindowAttributes_(0, 256, 0)
Here is the .pbl file
Code: Select all
;
-framework Carbon
ChangeWindowAttributes 3
Regards,
SEO
not if you were using the demo version
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Hi Polo!
1 - Fred have said that there is not much time for the Mac version.
And create an CarbonLib and dylibs take some time.
2 - And when you told me to buy, without know if it works or not. I guessNOBODY buy my application, if they not could test it out.
3 - 65USD is not much to me, but 1USD is to much if I purchase some that not works for me.
4 - Prhaps there are some other 'licensed' Mac users that would create and test carbonLib and dylibs. I think I could do it, because I have a lot of Carbon Functions written in an another language, I should try to convert and test. But should I pay 65USD to find that it not works? And also spend the time?
Thanks for your reply!
SEO
1 - Fred have said that there is not much time for the Mac version.
And create an CarbonLib and dylibs take some time.
2 - And when you told me to buy, without know if it works or not. I guessNOBODY buy my application, if they not could test it out.
3 - 65USD is not much to me, but 1USD is to much if I purchase some that not works for me.
4 - Prhaps there are some other 'licensed' Mac users that would create and test carbonLib and dylibs. I think I could do it, because I have a lot of Carbon Functions written in an another language, I should try to convert and test. But should I pay 65USD to find that it not works? And also spend the time?
Thanks for your reply!
SEO
Hi !
Unfortunately I don't think there's a lot of PB user on MacOSX (Mac are so expensive, I would love to have one ), but if you can call a function from another language it should be easy to call if with Purebasic
Basically, if the function is not directly wrapped (I mean not available as "myfunction_"), you can still do something like this (but you need to know a few things, like the library name, the number of parameters, ...)
BTW, Fred is quite busy to bring us Purebasic 4 on windows, it has been waited for years now, so he wants to concentrate on this before doing anything else.
Unfortunately I don't think there's a lot of PB user on MacOSX (Mac are so expensive, I would love to have one ), but if you can call a function from another language it should be easy to call if with Purebasic
Basically, if the function is not directly wrapped (I mean not available as "myfunction_"), you can still do something like this (but you need to know a few things, like the library name, the number of parameters, ...)
Not sure if these commands are included in the demo version though....lib=OpenLibrary(#PB_Any,"APILibYouWannaUse.so")
Function1=IsFunction(lib,"TheFunctionYouWannaUse")
;Call of the function
if Function1
CallFunctionFast(Function1,parameter1,parameter2,....)
endif
BTW, Fred is quite busy to bring us Purebasic 4 on windows, it has been waited for years now, so he wants to concentrate on this before doing anything else.