DeclareLibraryMBS methods

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

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.


💬 Ask a question or report a problem