[missing-sync-palmos-dev-talk] Conduit progress callback function

Stuart A. Malone samalone at llamagraphics.com
Thu May 18 11:17:46 PDT 2006


Hi all,

I've been spending some time tracking down a crash in the next  
version of our conduit, which will be built using  
libMissingSyncBridge.a.  The crash is occurring when we try to call  
the PROGRESSFNCARBON which is passed into OpenConduitCarbon.

Scott told me before about setting the first slot in the 'CInf'  
resource to 2, which tells something (Missing Sync?  the bridge  
library?) that this is a Mach-O conduit and not a CFM conduit.  That  
was enough to get the progress callback working under Missing Sync.

But the conduit was crashing under Palm Desktop.  I downloaded a  
fresh copy of the Sample Mach-O Conduit, and see that it now contains  
code to patch the progress callback:

PROGRESSFNCARBON inProgressCallBack =
	(PROGRESSFNCARBON) MachOFunctionPointerForCFMFunctionPointer((void *) 
inCFMProgressCallBack);

The problem is that this provides you with two different progress  
callbacks (inProgressCallBack and inCFMProgressCallBack) but doesn't  
tell you which one to call!  And if you guess wrong, you crash.

Clearly the solution is to detect whether we're running under Palm  
Desktop or Missing Sync, and only patch the callback if we're running  
under Palm Desktop.  So far the best solution I've come up with is to  
test the identifier of the main bundle:

if (::CFStringCompare(::CFBundleGetIdentifier(::CFBundleGetMainBundle 
()),
                       CFSTR("com.palm.HotSync.ConduitManager"), 0)  
== kCFCompareEqualTo) {
   inProgressCallBack = (PROGRESSFNCARBON)  
MachOFunctionPointerForCFMFunctionPointer((void *)inProgressCallBack);
}

This seems to work, but I'd actually be more comfortable if I could  
detect whether the main bundle is CFM or Mach-O directly, rather than  
assuming that the Conduit Manager is CFM and will always remain so.   
Do other folks know of a way to tell if a process is CFM or Mach-O?   
Or does anyone have a better idea about how to solve this problem?


Best wishes,

--Stuart A. Malone
   Llamagraphics, Inc.
   Makers of Life Balance personal coaching software
   http://www.llamagraphics.com/




More information about the missing-sync-palmos-dev-talk mailing list