Skip to content

loadlibrary

ffi · scripts/ffi/loadlibrary.m

LOADLIBRARY  Load a C shared library into Nexus (MATLAB R2026a compatible).

  loadlibrary (libname, hfile)
  loadlibrary (libname, @protofile)
  loadlibrary (..., Name, Value)
  [notfound, warnings] = loadlibrary (...)

  Nexus implements the MATLAB Generic DLL front end for **struct mapping**
  and **callback (FcnPtr) pointers** via prototype files.  A prototype
  function (or .m loader) registers struct field layouts and function
  signatures without requiring a C preprocessor on this host.  Native
  thunk/calllib execution of an on-disk .so/.dll is completed by the
  build-thread FFI backend; until then calllib still errors for unbound
  native symbols, while libstruct / libpointer / libisloaded work.

  Name-Value options (MATLAB): alias, addheader, includepath, mfilename,
  thunkfilename.  With a prototype handle, only alias is meaningful here.