Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

SoftDeclareMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Declare MBS Util Plugin Yes Yes Yes Yes No
Function: 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
Notes:
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.

Feedback, Comments & Corrections

This class has no sub classes.

Some examples which use this class:


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


SmartCardMBS   -   Sound




Links
MBS Xojo Chart Plugins