Livecode builder Foreign Function Interface question.

Are you developing tools to extend the LiveCode environment? This is the place to talk about the nuts and bolts of extending our nuts and bolts. If you want to use a LiveCode or third party Environment extension, visit the Using Evironment Extensions forum.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
zaxos
Posts: 222
Joined: Thu May 23, 2013 11:15 pm
Location: Greece

Livecode builder Foreign Function Interface question.

Post by zaxos » Thu Mar 14, 2019 5:32 pm

Hello everyone! I want to wrap: https://twapi.magicsplat.com/ in livecode builder but I'm having trouble understanding the binding part. For example

Code: Select all

  private foreign handler win_sparkle_init() \
        returns nothing binds to "c:winsparkle>win_sparkle_init!cdecl"
in this code (taken from levurehelper-app_updater made by Trevor Devore), if someone could explain the

Code: Select all

binds to "c:winsparkle>win_sparkle_init!cdecl"
part. How does lcb know in which dll to search for? is the first part the dll name "c:winsparkle>" and the second part "win_sparkle_init!cdecl" the function inside the dll? If that's the case do I have to register the dll somewhere or just have it inside the .lcb folder?
Thank you.
Knowledge is meant to be shared.

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

Re: Livecode builder Foreign Function Interface question.

Post by PaulDaMacMan » Fri Mar 15, 2019 9:44 pm

is the first part the dll name "c:winsparkle>" and the second part "win_sparkle_init!cdecl" the function inside the dll?
Yes the 'c' is the language, winsparkle is the name of the dll/library to look into, win_sparkle_init!cdecl is the function to look for. The format is slightly different for binding to other languages like Objective C or Java.
do I have to register the dll somewhere or just have it inside the .lcb folder?
Thank you.
No.
Maybe someone will correct me if I'm wrong but I believe it looks for foreign functions in dlls/libraries in the following locations:
1) the sub-directories of your LCB project folder
2) in the normal locations for shared libraries, whatever those locations may be on the current operating system
3) functions that are built into LiveCode itself or in libraries that the LC engine is linked to (such as the C standard library)
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

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

Re: Livecode builder Foreign Function Interface question.

Post by PaulDaMacMan » Fri Mar 15, 2019 9:47 pm

BTW, this question should be in the LiveCode Builder section of the forums.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Post Reply

Return to “Making IDE Plugins”