On May 30, 2005, at 2:49 AM, Philip George wrote:
issue resolved by switching build type to Mach-O and removing the
"Lib" suffix from each of the declares:
#if TargetMachO
dim devices as integer
Declare Function DRCopyDeviceArray Lib "DiscRecording" () as
integer
Declare Function CFArrayGetCount Lib "CoreFoundation" (devarray as
integer) as integer
Declare Function CFArrayGetValueAtIndex Lib "CoreFoundation"
(devarray as integer, i as integer) as integer
Declare Function DRDeviceAcquireExclusiveAccess Lib
"DiscRecording" (thedev as integer) as integer
devices = DRCopyDeviceArray()
if CFArrayGetCount(devices) > 0 then
if
DRDeviceAcquireExclusiveAccess(CFArrayGetValueAtIndex(devices, 0)) = 0
then
MsgBox "EXCLUSIVE ACCESS TO CD/DVD BURNER ACQUIRED"
else
MsgBox "PROBLEM ACQUIRING EXCLUSIVE ACCESS TO CD/DVD BURNER"
end
else
MsgBox "NO CD/DVD BURNER FOUND"
end
#endif
by the way, does this look leaky? how do i clean up after i'm done
with all the stuff allocated on the heap (1 CFArray and 1 or more
DRDevices)? ...or does rb take care of this for me?
REALbasic most certainly does not take care of it for you. You need to
release the reference returned by DRCopyDeviceArray when you're
finished with it using the Core Foundation function CFRelease. My book
on declares at <http://www.quantum-meruit.com/rb/> has a chapter on
Core Foundation; it contains a discussion of memory management. As for
the DR functions, you should read the header files to see if any
guidance is provided.
--------------
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|