MiniM. Saving time.


| About | Download | Tools | Knowledge Base | How to Buy |

MiniM Overview

Getting Started

Download

Documentation

Tools

Cache Tools

GT.M Tools

Knowledge Base

FAQ

Contacts

Copyrights

MiniM Knowledge Base | Feb 3, 2015

ZDLL file extension

To be crossplatform, MUMPS code for ZDLL must know about differences in file naming in different operationg systems.

To call external functions placed in ZDLL module, MUMPS code must specify file name of this ZDLL module. So, this point is dependent of the target operating system. Dynamic link libraries can be called id code use absolute path specification or short file name without path. In this case Windows searches in currnt directory of executable and in Unix-based systems operating system searches from directories listed in special environment variable.

MiniM can be installed several times into different directories and this Mini Minstances can be run independently from the each other, so recommended way is to place ZDLL files into /bin subdirectory of MiniM instance. Remember, that different MiniM instances can have event different bitness, and cannot use same library files.

To fix common divisor, MiniM uses convention about locating ZDLL dynamic link libraries in the /bin directory by default.

To specify ZDLL module name in the MUMPS code (function $zdll), developer must calculate real file name. So, here can be recommended to use special reusable function with file name calculation:

libname()
 i .. q "one.ext1"
 q "one.ext2"
appfunc()
  q $zdll(...,$$libname(),...)

File name calculation must use operating system file name conventions and call conventions. OS specific conventions are:

Windows
Can call library in current directory (bin directory is enought) or listed in the PATH environment variable, extension is DLL.
Mac OSX
Can call library in directories listed in LD_LIBRARY_PATH environment variable, extension is DYLIB.
Linux, FreeBSD, Android
Can call library in directories listed in LD_LIBRARY_PATH environment variable, extension is SO.

To determine operating system, MUMPS code must call external commands such as VER or UNAME, or other commands, or call builtin MINIM system functions:

$ZVERSION
This system variable returns all string with target operating system version built for and current version of MiniM.
$ZVERSION()
This system function returns different parts of target version, $ZV(2) returns target operating system version built for.

This are builtin constants, and target operating system built for is constant. This value specifies target operating system. Real operating system can differs from the target becouse some operating systems can run executables for other systems or executables can be run under emulators. In any way, MUMPS code must use call conventions of the target operating system.

And one more remark - unlike of Apple developes Mac OSX operating systems, this is not true internal codename for developers, developers use codename Darwin. So, function $ZV(2) in MiniM returns in this case "Darwin" too, not "Mac" or "Mac OS" or any other.

After mixing all described rules and conditions, we can have the following common divizor:

LibName()
 ; case of Windows, current /bin directory
 i $zv(2)["Windows" q "zini.dll"
 ; case of Mac OSX, current /bin directory
 i $zv(2)["Darwin" q "./libzini.dylib"
 ; case of Linux, FreeBSD and Android, current /bin directory
 q "./libzini.so"
UserFunc()
 ...
 ...=$zdll(...,$$LibName(),...)
 ...

Евгений Каратаев
support@minimdb.com


Copyright (C) 2017 Eugene Karataev
Emails: Info Tech Support