Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Barcode.LoadLibrary

Loads the zbar library.

Component Version macOS Windows Linux Server iOS SDK
Barcode 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Barcode.LoadLibrary"; Path )   More

Parameters

Parameter Description Example
Path Native file path to the library.
A dylib on macOS, a DLL file on Windows and a shard object on Linux wiht so extension.
"/tmp/libzbar.so.0"

Result

Returns OK or error.

Description

Loads the zbar library.
Our Barcode.Scan function uses the open source zbar library. Since this library is licensed under LGPL, we can't embed it within the plugin, but you can ship it with your solution, either as a file you install with the plugin or as a file you store in a container and then export to a temp folder.

If you have a libzbar64-0.dll in the FileMaker application folder, you can simply pass "libzbar64-0.dll" as path to load on Windows.

We have libraries for you here:
https://www.monkeybreadsoftware.com/filemaker/files/Libs/

With MBS Plugin v13.2, we implemented automatic loading of a zbar library if you don't call Bacode.LoadLibrary yourself. We look for libzbar64-0.dll on Windows, libzbar.so.0 on Linux and libzbar.dylib on macOS.

If you have trouble with DLLs not loading on Windows, please check if you have new Visual Studio Runtime libraries installed. If you need more than one DLL, please use Process.SetDllDirectory to point to the folder to find the DLL files.

Examples

Load the zbar library on macOS:

MBS( "Barcode.LoadLibrary"; "/Users/cs/Desktop/zbar/libzbar.0.dylib" )

Load the zbar library on Linux:

MBS( "Barcode.LoadLibrary"; "/usr/lib/x86_64-linux-gnu/libzbar.so.0" )

// needs to install package on Linux:
// sudo apt-get install libzbar0

Load on various operation systems:

If [ MBS("IsWindows") ]
    # you may need to download zbar from our Libs folder or get your own
    # our copy of the library has a dependency, so we load libiconv first
    Set Variable [ $path ; Value: "C:\Users\Christian\Desktop\libiconv.dll" ]
    Set Variable [ $r ; Value: MBS( "Process.LoadLibrary"; $Path ) ]
    # now we can load zbar dll
    Set Variable [ $path ; Value: "C:\Users\Christian\Desktop\libzbar64-0.dll" ]
Else If [ MBS("isMacOS") ]
    # you may need to download zbar from our Libs folder or get your own
    Set Variable [ $path ; Value: "/Users/cs/Desktop/zbar/libzbar.0.dylib" ]
Else If [ MBS("isLinux") ]
    # you may need to install first: sudo apt-get install libzbar0
    Set Variable [ $path ; Value: "/usr/lib/x86_64-linux-gnu/libzbar.so.0" ]
Else
    Show Custom Dialog [ "Unsupported platform" ; "No library coded for this platform or no MBS Plugin installed." ]
    Halt Script
End If
#
# load zbar
Set Variable [ $r ; Value: MBS("Barcode.LoadLibrary"; $path) ]
If [ MBS("IsError") ]
    Show Custom Dialog [ "Failed to load library" ; $r ]
End If

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 23th May 2021, last changed 12nd January 2024


Barcode.LibVersion - Barcode.Loaded