Platforms to show: All Mac Windows Linux Cross-Platform

Back to DeclareLibraryMBS class.

DeclareLibraryMBS.Constructor(LibFile as folderItem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynamicDeclares MBS Util Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Loads a library.

Pass path to DLL on Windows, dylib on MacOS or so file on Linux.
Raises exception in case of problems.

See also:

DeclareLibraryMBS.Constructor(LibPath as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynamicDeclares MBS Util Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Loads a library.
Example
// change path if you like to try this on Windows or Linux
Dim d As New DeclareLibraryMBS("/usr/lib/libz.1.dylib")

Dim lines() As String = d.SymbolNames
Break // look in list of functions

Pass path to DLL on Windows, dylib on MacOS or so file on Linux.
Raises exception in case of problems.

See also:

DeclareLibraryMBS.Symbol(name as string) as ptr

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynamicDeclares MBS Util Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries function or data pointer for a symbol.
Example
// change path if you like to try this on Windows or Linux
Dim d As New DeclareLibraryMBS("/usr/lib/libz.1.dylib")

// zlibVersion
// ZEXTERN Const char * ZEXPORT zlibVersion Of((void));

Dim p As ptr = d.Symbol("zlibVersion")
Dim f As New DeclareFunctionMBS("()Z", p)

Dim n As String = f.Invoke
MsgBox "zlibVersion: "+n

Returns nil if not found.

DeclareLibraryMBS.SymbolName(index as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynamicDeclares MBS Util Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries name of a symbol.

Index is in range from 0 to SymbolCount-1.

See also:

DeclareLibraryMBS.SymbolName(p as Ptr) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynamicDeclares MBS Util Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries name of a symbol from the ptr.

Looks up the symbol table to find the entry with the right pointer and returns the name.
Returns "" if not found.

See also:

DeclareLibraryMBS.SymbolNames as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynamicDeclares MBS Util Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries list of symbols of a library.
Example
// change path if you like to try this on Windows or Linux
Dim d As New DeclareLibraryMBS("/usr/lib/libz.1.dylib")

Dim lines() As String = d.SymbolNames
Break // look in list of functions

This may show more symbols as defined in public C headers.

Some examples using this method:

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...