CarbonLib

Mac OSX specific forum
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

CarbonLib

Post 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
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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 :).
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Thanks!
I should check it out ..
SEO
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post 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
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Ha yes, direct API support isn't support in the demo version.
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Should i fill an BUG report? :D

/SEO
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

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... )
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

SEO wrote:Should i fill an BUG report? :D
No, but you can fill the Purebasic purchase form 8)
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post 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
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post by SEO »

Thanks for your answers:

I think it is better to close this 'Project'!!

bye!
//SEO
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

I recommend a purchase of the software and not to give up so easily.

Sincerely,
Intrigued - Registered PureBasic, lifetime updates user
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post 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
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post by Polo »

Maybe you can mail Fred to ask him a little example to prove you it does work ?
SEO
Enthusiast
Enthusiast
Posts: 178
Joined: Fri Dec 09, 2005 11:42 pm
Location: Sweden
Contact:

Post 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
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Post 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 :cry:), 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.
Post Reply