CoreFoundation / C APIs binding strings more examples?

Moderators: LCMark, LCfraser

Post Reply
PaulDaMacMan
Posts: 190
Joined: Wed Apr 24, 2013 4:53 pm

CoreFoundation / C APIs binding strings more examples?

Post by PaulDaMacMan » Wed May 09, 2018 1:31 am

I'm getting the hang of Objective C binding string stuff (having a blast!), and I've played around a bit with the Android/JAVA binding string stuff, but I'm a bit stumped by C bindings. Are there any more examples of binding to C API's, like ones that come with an OS (not foreign lib binaries in a resource folder)? I have many questions like how do you determine the "signature" of an C API? I've seen the TimeZone tz> example in LC9 but there's not all that much to learn from it other than the use of (experimental) aggregate type definition.

Thanks

PaulDaMacMan
Posts: 190
Joined: Wed Apr 24, 2013 4:53 pm

Re: CoreFoundation / C APIs binding strings more examples?

Post by PaulDaMacMan » Wed May 09, 2018 9:48 pm

http://forums.livecode.com/viewtopic.ph ... 3&start=15

I dug up this old thread which helped a bit... So if it's a C API (like CFoundation stuff) that's in the System, part of the available OS API's, I shouldn't need to worry about a path to a lib or anything (3rd party dynamic libs in a resource folder aside), I just bind to a function from any of them and make sure I feed it correct data types and specify a container of the correct type for the return value and it should be good, is that correct?

I think the thing throwing me off is ObjC bindings make it very clear to me what methods/function parameters the foreign handler is binding to versus plain old C where you just have to already know how many parameters and what data types the foreign code expects and provide them correctly or get a binding error at compile time (I'm assuming).

PaulDaMacMan
Posts: 190
Joined: Wed Apr 24, 2013 4:53 pm

Re: CoreFoundation / C APIs binding strings more examples?

Post by PaulDaMacMan » Wed May 16, 2018 8:39 pm

This thread was pretty much answered in this thread:
http://forums.livecode.com/viewtopic.php?f=93&t=31013

The binding string format for CF-CoreFoundation/ C-API stuff in macOS is:
c:FrameWorkBundleName.framework>functionName

Post Reply

Return to “LiveCode Builder”