Platforms to show: All Mac Windows Linux Cross-Platform

SoftDeclareMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Declare MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
A way to do soft linking to libraries.
Example
// Load the Stuffit Bundle on Mac OS X:
dim f as FolderItem
dim s as SoftDeclareMBS

f=FrameworksFolderMBS(-32765).Child("StuffIt.framework")
s=new SoftDeclareMBS

if s.LoadFrameworkFile(f) then
MsgBox "ok"
end if

Deprecated. Please move to newer DeclareLibraryMBS and DeclareFunctionMBS classes.

You can make a declare like this:

Declare Function SpeakString lib "SpeechLib" (SpeakString as pstring) as Integer

But what if the SpeechLib is not installed?
Simple, but your application won't even launch on this machine.
Now you can of course use this MBS Plugin using the SpeechMBS functions, which are all week linked.
But you can also use this class to weak link to the SpeechMBS library like this:

dim b as boolean, m,p as memoryblock, c as SoftDeclareMBS

c=new SoftDeclareMBS
p=newmemoryBlock(256) // make the string for the first parameter
p.pstring(0)="Hello World!"

m=newmemoryBlock(4) // make the memoryblock for the parameters
m.long(0)=p.Address(0) // set the first parameter to the address of the string buffer

if c.loadlibrary("SpeechLib") then // Load librarys
if c.loadfunction("SpeakString") then // Load function
b=c.Call(1,m)
end if
end if

This way your application will be loaded, you can call the function, but people who don't have the SpeechLib will also here it.

This class has no sub classes.

Some examples using this class:

Blog Entries

Xojo Developer Magazine


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


SmartCardMBS   -   Sound


The biggest plugin in space...