Page 1 of 1

Livecode builder Foreign Function Interface question.

Posted: Thu Mar 14, 2019 5:32 pm
by zaxos
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.

Re: Livecode builder Foreign Function Interface question.

Posted: Fri Mar 15, 2019 9:44 pm
by PaulDaMacMan
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)

Re: Livecode builder Foreign Function Interface question.

Posted: Fri Mar 15, 2019 9:47 pm
by PaulDaMacMan
BTW, this question should be in the LiveCode Builder section of the forums.