How to call the native code in Live Code

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Devil
Posts: 5
Joined: Thu Mar 06, 2014 9:42 am

How to call the native code in Live Code

Post by Devil » Thu Mar 06, 2014 9:52 am

How to call the native code in Live Code

I wanna write an app which can run on both Mac OS and Window, but it may dependence native code , such as in Java we can call method in ".so" or ".dll" file by the JNI. Can Live Code call the native code as Java ?

Thanks

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to call the native code in Live Code

Post by Klaus » Thu Mar 06, 2014 1:39 pm

Hi Devil (? come on 8) )

1. welcome to the forum! :D

2. Sorry, not sure what you are talking about?
What "native" code?


Best

Klaus

Devil
Posts: 5
Joined: Thu Mar 06, 2014 9:42 am

Re: How to call the native code in Live Code

Post by Devil » Fri Apr 04, 2014 3:15 am

Klaus wrote:Hi Devil (? come on 8) )

1. welcome to the forum! :D

2. Sorry, not sure what you are talking about?
What "native" code?


Best

Klaus
Thanks for your reply.

sorry for my poor English.

Do you know JNI ? Java Language can call C\C++ function by JNI. So my Question is Can Live Code call C\C++ function, I've try my best to search it in the document, but failed at last.

CenturyMan1979
Posts: 86
Joined: Tue May 15, 2012 5:56 pm

Re: How to call the native code in Live Code

Post by CenturyMan1979 » Fri Apr 04, 2014 4:34 am

You can take your C/C++ code and turn it into an external for LiveCode as I don't know of a way to directly interact with C/C++ code from within LiveCode. If you want to check out information on making an external then take a look at http://livecode.com/developers/guides/d ... externals/ or you can look at this entry in the LiveCode wiki http://livecode.wikia.com/wiki/Working_with_DLL

Devil
Posts: 5
Joined: Thu Mar 06, 2014 9:42 am

Re: How to call the native code in Live Code

Post by Devil » Fri Apr 04, 2014 8:03 am

CenturyMan1979 wrote:You can take your C/C++ code and turn it into an external for LiveCode as I don't know of a way to directly interact with C/C++ code from within LiveCode. If you want to check out information on making an external then take a look at

Thanks , I'll try it.

Have a nice day!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: How to call the native code in Live Code

Post by dunbarx » Fri Apr 04, 2014 2:18 pm

Devil.

I would be interested to know what reason you might have to want to do this. Is it for increased speed? Or access to low-level machine functionality not available "natively" in LC?

Know that LC has the ability to maintain library functionality is several ways, and these do not necessarily require plug-ins.

Craig Newman

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: How to call the native code in Live Code

Post by Mag » Fri Apr 04, 2014 2:24 pm

Hi Devil,

not sure whether could fit your needs but maybe you want to take a look at the "do" in the dictionary, it works with "active scripting" languages such as VBScript.
do statementList [as alternateLanguageName] [in caller]

statementList - A LiveCode statement, a container with one or more statements, or a string that evaluates to a statement.
alternateLanguageName - On Mac OS and OS X systems, the alternateLanguageName is a script language (such as AppleScript) supported under the Open Scripting Architecture. On Windows systems, the alternateLanguageName is an "active scripting" language (such as VBScript) supported by the Windows Scripting Host. The available languages are returned by the alternateLanguages function. If you specify an alternateLanguageName, the statementList must be written in the specified language.

Devil
Posts: 5
Joined: Thu Mar 06, 2014 9:42 am

Re: How to call the native code in Live Code

Post by Devil » Sat Apr 05, 2014 9:15 am

dunbarx wrote:Devil.

I would be interested to know what reason you might have to want to do this. Is it for increased speed? Or access to low-level machine functionality not available "natively" in LC?

Know that LC has the ability to maintain library functionality is several ways, and these do not necessarily require plug-ins.

Craig Newman
Hi, dunbarx,

Thanks for your reply.

My team has a c library for "Image Processing", we want to the library work with LC both on Windows and Mac.

Devil
Posts: 5
Joined: Thu Mar 06, 2014 9:42 am

Re: How to call the native code in Live Code

Post by Devil » Sat Apr 05, 2014 9:32 am

Mag wrote:Hi Devil,

not sure whether could fit your needs but maybe you want to take a look at the "do" in the dictionary, it works with "active scripting" languages such as VBScript.
do statementList [as alternateLanguageName] [in caller]

statementList - A LiveCode statement, a container with one or more statements, or a string that evaluates to a statement.
alternateLanguageName - On Mac OS and OS X systems, the alternateLanguageName is a script language (such as AppleScript) supported under the Open Scripting Architecture. On Windows systems, the alternateLanguageName is an "active scripting" language (such as VBScript) supported by the Windows Scripting Host. The available languages are returned by the alternateLanguages function. If you specify an alternateLanguageName, the statementList must be written in the specified language.

Thanks for your help , I'll have a try.

Post Reply