[futurebasic] Re: [FB] Testing shared libraries

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2001 : Group Archive : Group : All Groups

From: Heather Donahue <heatherd@...>
Date: Wed, 24 Oct 2001 23:20:24 -0700
At 8:06 PM -0400 on 10/24/01, Sylvain Guillemette wrote:


>A similar function can also be found on the FB^3 CD-ROM.
>
>Sylvain

While there are some examples that use FindSymbol, there isn't one 
that specifically uses it to test for a specific library.

Obviously there isn't anything special about the function I listed. 
After looking at and porting over much C code, I've noticed that in C 
programmers routinely check for symbols when coding.  In C it is very 
simple and I'm not even entirely sure how it's done.

I brought this up because of the discussion about NavServices.  In 
the Navigation.Incl in the headers folder, the NavServicesCanRun 
function should be called in addition to checking for the library. 
In that Incl file it is listed like this:

TOOLBOX FN NavServicesAvailable()                        = Boolean

If you call that function you will crash, the reason is it isn't a 
function but an inline macro that looks like:

#define NavServicesAvailable()  ((NavLibraryVersion != 
(void*)kUnresolvedCFragSymbolAddress) && NavServicesCanRun())

By some method I don't entirely understand, in C, you can simply 
check for an unresolved symbol directly.  To do this in FB, we would 
have to use FindSymbol

To convert the C I would do this:

DEF FN NavServicesAvailable = ¬
( FBTestForSymbol( "NavigationLib", "NavLibraryVersion" ) && ( FN 
NavServicesCanRun == _true ))

I think this should replace the NavServicesAvailable in the 
Navigation.Incl file and FBTestForSymbol should be in the runtime.
-- 
Heather Donahue
--
non sum qualis eram