Load and use C dynamic libraries OSX

Learning APL or new to Dyalog? Ask "silly" questions here, without fear...

Load and use C dynamic libraries OSX

Postby alexeyv on Mon Dec 14, 2015 8:06 pm

Hi,

Is where any way to load and use C dynamic libraries (.so/.dylib) in Dyalog OSX? Something like CFFI for Python etc.
alexeyv
 
Posts: 56
Joined: Tue Nov 17, 2015 4:18 pm

Re: Load and use C dynamic libraries OSX

Postby AndyS|Dyalog on Tue Dec 15, 2015 10:39 am

⎕NA is your friend here.

Currently the documentation is rather Windows-centric, but you may find taking a look at the function R.rscproxyUNIX.init will give you some clues, as well as the contents of http://help.dyalog.com/14.1/index_Left.htm#CSHID=UNIX_IUG%2FQuadNA.htm|StartTopic=Content%2FUNIX_IUG%2FQuadNA.htm

Since you will be running a shared library/DLL within the APL process, it is very easy to write over the workspace in memory, and it is very easy to mis-define the parameters to ⎕NA calls. In both cases a syserror is the likely outcome. From personal experience I strongly recommend that you save your code often, and set the environment variable ERRORONEXTERNALEXCEPTION=1 while you develop your code.
User avatar
AndyS|Dyalog
 
Posts: 235
Joined: Tue May 12, 2009 6:06 pm

Re: Load and use C dynamic libraries OSX

Postby alexeyv on Tue Dec 15, 2015 9:28 pm

Thanks for pointers, I'll try it out.
alexeyv
 
Posts: 56
Joined: Tue Nov 17, 2015 4:18 pm


Return to New to Dyalog?

Who is online

Users browsing this forum: No registered users and 1 guest