Page 1 of 1
MacOS X API functions
Posted: Thu Feb 26, 2009 4:53 am
by WilliamL
On the PB site, in Introduction, in PureBasic MacOS X, it says:
- The MacOS X API functions are supported as if they were BASIC keywords
What does that mean and how do you use them?
Posted: Thu Feb 26, 2009 12:06 pm
by Kale
Posted: Fri Feb 27, 2009 6:19 pm
by WilliamL
ok, I admit it, I don't understand what API means. It appears to me that the Windows community has a 'library(?)' that extends the abilities of PB by using pre-defined commands simply inserted in the code just like PB commands. Why can't a library like that be made for the Mac? Is the Windows library a 3rd party item or is it provided by PB?
..or do I have the whole thing mixed up?
Posted: Fri Feb 27, 2009 6:49 pm
by Kale
An API is an application programming interface which is given purely so developers can write apps to use the functionality exposed by it.
Why can't a library like that be made for the Mac?
I ask the same thing.
Posted: Fri Feb 27, 2009 8:01 pm
by WilliamL
What I'm getting at, by example, is that in Windows there is a command to put the cursor at a location in a stringgadget. That command appears to be a windows API command. What I read in your provided link didn't appear to be leading to be able to do that (even if I could figure out how to use it).
It is also interesting that Carbon is 'depreciated' and is no longer encouraged to be used.. so Cocoa (?) is the API to use.
Well, I don't know what any of this means and will never figure out how to use any of it. I just feel that PB needs to have a little more functionality (like being able to place a cursor in a stringgadget location, etal.) to be attractive to Mac users. I was hoping the API thing might lead to that.
Posted: Sun Mar 01, 2009 9:15 am
by lexvictory
for some OS X API calls, you need to manually make pb aware of them using a .pbl file and pbsoimporter
eg.
http://purebasic.fr/english/viewtopic.p ... 533#244533
I have a hard time believing that Carbon is deprecated; Seeing as it's the C API. Not sure how you would use Cocoa in PB (as its OO)
Posted: Sun Mar 01, 2009 11:17 pm
by WilliamL
I thought I made it clear that I didn't know about these things. The argument isn't with me, I don't know anything about APIs.. and I'm not interesting in learning about them. If the programming gods (like Fred/Freak/maybe you) give us more in PB, I am grateful.
Carbon is a procedural C interface for Mac OS X. Whether you are writing a new application or porting one from another platform, Carbon is an excellent framework for developing on Mac OS X. If you're developing new applications and prefer an object-oriented interface, be sure to consider Cocoa.
If you are familiar with C programming but not with Carbon or Mac OS X, you want to learn how to design and implement a basic user interface and then learn how to build a Carbon application using Mac OS X development tools. After that, you’ll want to explore the various Carbon "managers" and "services" for APIs specific to your needs.
The Cocoa frameworks are primarily written in Objective-C, and support both 32-bit and 64-bit applications as well as Objective-C 2.0's garbage collection, although there are a few components written in other languages such as C for performance or compatibility reasons, such as Core Foundation. The Cocoa frameworks are completely accessible to Objective-C programs, and can even be accessed using native syntax from AppleScript, Python, and Ruby. Example frameworks included within Cocoa are Foundation, which defines the "nuts and bolts" classes for Objective-C programming, and Application Kit which includes higher-level controls such as windows, buttons, menus, and text fields. Whatever you need to develop, Cocoa contains the frameworks to make development productive and enjoyable.
Please excuse my ignorance...
Posted: Mon Mar 02, 2009 12:04 am
by freak
> I have a hard time believing that Carbon is deprecated; Seeing as it's the C API. Not sure how you would use Cocoa in PB (as its OO)
It is. New functionality is rarely added to Carbon, its all done for Cocoa. Carbon will probably be around for a long time for compatibility, but its not the framework of choice anymore. I've also read that Carbon will not be available in 64bit which kind of sucks. One day we will have to port the entire PB library set to Cocoa to keep up. My blood runs cold when i think about the work that'll be, especially since i am not the biggest fan of ObjectiveC
The Carbon API is currently not available directly in PB because it is a lot of work to convert the headers for that. Even if most of it is done through automated tools, these usually make a lot of mistakes which have to be solved by hand.
WilliamL:
If there is some functionality you are missing, just post it in the feature request section. I am sure most windows users will prefer a native PB function over the OS API as well.