Platforms to show: All Mac Windows Linux Cross-Platform
/Util/IOMasterPort via SoftDeclare
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/IOMasterPort via SoftDeclare
This example is the version from Sun, 17th Mar 2012.
Project "IOMasterPort via SoftDeclare.xojo_binary_project"
Class Window1 Inherits Window
EventHandler Sub Open()
dim s as SoftDeclareMBS
dim m as MemoryBlock
dim p as MemoryBlock
// kern_return_t IOMasterPort( mach_port_t bootstrapPort, mach_port_t * masterPort );
m=NewMemoryBlock(8)
p=NewMemoryBlock(4)
s=new SoftDeclareMBS
p.Long(0)=0 // the port value will be placed here
m.Long(0)=0 // constant MACH_PORT_NULL
m.Long(4)=p.AddressMBS(0) // Pointer for second parameter to p
if s.LoadLibrary("System.framework") then
if s.LoadFunction("IOMasterPort") then
if s.CallFunction(2,m) then
MsgBox "Result: "+str(s.Result)+", Port: "+str(p.Long(0))
end if
end if
end if
End EventHandler
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
The items on this page are in the following plugins: MBS Util Plugin.