Ben Combee wrote:
> At 02:19 PM 1/5/2005, you wrote:

>> I'm trying to compile an ARM static library (fdlibm), but if i don't
>> check
>> the force C++ compilation box
>> the function within are not found when i try to use this lib in a
>> project.
>>
>> Is this normal ? any config i missed ?
> 
> 
> ARM name mangling... if you compiled the library as C code, not C++
> code, then the prototypes for calling the library from your C++ code
> need to be surrounded by an
> 
>    extern "C" {
>    }
> 
> block to tell the compiler that these are C functions.

... and a common way to do this is to have one .h file that contains
all your C-style stuff in it, and #include that .h file from both
C (library implementation) and C++ code (client) code.  The way
you accomplish this is to put

        #ifdef __cplusplus
        extern "C" {
        #endif

before all your function prototypes, and put

        #ifdef __cplusplus
        }  // extern "C"
        #endif

after the prototypes.

Then, when building your library as C source, the compiler sees
no "extern" or anything, but when using the .h file from C++, the
prototypes are surrounded with the appropriate stuff.

  - Logan

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to