Page 1 of 3
CarbonLib
Posted: Tue Dec 13, 2005 3:07 am
by SEO
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
Posted: Tue Dec 13, 2005 11:59 pm
by Fred
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:
Code: Select all
pbsoimporter control.pbl /TO /Users/yourhome/yourdrawer/purebasic
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

.
Posted: Wed Dec 14, 2005 12:15 am
by SEO
Thanks!
I should check it out ..
SEO
Posted: Wed Dec 14, 2005 2:18 pm
by SEO
CarbonLib....
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)
I also tested without 'err'
Here is the .pbl file
Code: Select all
;
-framework Carbon
ChangeWindowAttributes 3
Then I put the carbonx file in the macos folder together with control, core and so on....
Regards,
SEO
Posted: Wed Dec 14, 2005 2:56 pm
by Fred
Ha yes, direct API support isn't support in the demo version.
Posted: Wed Dec 14, 2005 3:10 pm
by SEO
Should i fill an BUG report?
/SEO
Posted: Wed Dec 14, 2005 3:47 pm
by blueznl
not if you were using the demo version

Posted: Wed Dec 14, 2005 3:50 pm
by Polo
SEO wrote:Should i fill an BUG report?

No, but you can fill the Purebasic purchase form

Posted: Wed Dec 14, 2005 3:51 pm
by SEO
Ok, is there some that could 'show' that is working? (compiled app)
I spent some days on this now, and would not pay for my work i have done so far...
//SEO
Posted: Wed Dec 14, 2005 3:57 pm
by SEO
Thanks for your answers:
I think it is better to close this 'Project'!!
bye!
//SEO
Posted: Thu Dec 15, 2005 2:02 am
by Intrigued
I recommend a purchase of the software and not to give up so easily.
Sincerely,
Posted: Thu Dec 15, 2005 2:36 am
by SEO
What is it I am purchasing?
Could some show in an compiled app that dylibs and Carbon calls work on Mac?
Without these, you can't create Mac apps, and then why should i spend both time an money on it??
Regards,
SEO
Posted: Thu Dec 15, 2005 7:40 am
by Polo
Maybe you can mail Fred to ask him a little example to prove you it does work ?
Posted: Thu Dec 15, 2005 6:01 pm
by SEO
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
Posted: Thu Dec 15, 2005 6:19 pm
by Polo
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, ...)
lib=OpenLibrary(#PB_Any,"APILibYouWannaUse.so")
Function1=IsFunction(lib,"TheFunctionYouWannaUse")
;Call of the function
if Function1
CallFunctionFast(Function1,parameter1,parameter2,....)
endif
Not sure if these commands are included in the demo version though....
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.