daneelsan / ICULinkDemo

Demo how to connect to the ICU libraries in Wolfram Language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo for the ICULink paclet

This demo corresponds to a WTC23 talk which discussed ways in which to call external libraries using 2 approaches: the Foreign Function Interface and the Wolfram Compiler.

FFI

To use the FFI section of this demo, simply do:

Load the paclet directory:

PacletDirectoryLoad["~/path/to/ICULink"];

Do a Needs of the paclet:

Needs["ICULink`"]

Call a function defined in ICULink`FFI:

In[]:= ICULink`FFI`UnicodeVersion[]
Out[]= {11, 0, 0, 0}

Compiled Component

Build the ICULink compiled component

Run the script:

./scripts/build.wls

The generated library should be stored in (depending on your OS):

$ ls ICULink/LibraryResources/MacOSX-ARM64/
ICULink.dylib*

Load the ICULink compiled component

Load the paclet directory:

PacletDirectoryLoad["~/path/to/ICULink"];

Do a Needs of the paclet:

Needs["ICULink`"]

Call any of the functions defined in ICULink`CC and the compiled component should be autoloaded:

In[]:= ICULink`CC`UnicodeVersion[]
Out[]= {11, 0, 0, 0}

About

Demo how to connect to the ICU libraries in Wolfram Language


Languages

Language:Mathematica 100.0%