I'm playing around with some toolbox functions and I found one that I
didn't think that I could call because its name begins with an
underscore.
I've never tried to call a PPC Toolbox function (in a library)
directly. I'm not sure if I'm doing it right because, frankly, the
MixedMode information in MixedMode.h and IM is rather confusing.
This is the code I came up with and it appears to work, of course
it's possible that it's doing damage behind the scenes.
Anyone know more about this?
'------------------------------
TOOLBOX FN NewRoutineDescriptor (PTR, UNSIGNED LONG, SINT8) = PTR
TOOLBOX DisposeRoutineDescriptor (PTR)
_kPrivateCFragCopy = 0x0005
DIM AS PTR procPtr, symAddr
DIM AS LONG @ connID, addrs
DIM libName AS STR63: libName = "MPLibrary"
DIM err AS WORD
DIM symClass AS BYTE
DIM msg AS STR255
DIM symName AS STR63: symName = "_MPIsFullyInitialized"
// Get and load MPLibrary and its transition vector address
err = FN GetSharedLibrary ( libName, _"pwpc", _kPrivateCFragCopy, ¨
@connID, @addrs, msg )
err = FN FindSymbol ( connID, symName, @symAddr, @symClass )
// create routine descriptor and get UPP
_kPowerPCISA = 1
DIM ISAType AS SINT8: ISAType = _kPowerPCISA
DIM theProcInfo AS UNSIGNED LONG: theProcInfo = _Pascalstk_rtnByte
procPtr = FN NewRoutineDescriptor (symAddr, theProcInfo, ISAType)
// call function
DIM bool AS BOOLEAN
bool = UNIVERSALFN(procPtr,_rtnByte)
PRINT bool
// Dispose of routine descriptor
CALL DisposeRoutineDescriptor (procPtr)
'------------------------------
--
Heather Donahue
-- non sum qualis eram