In a message dated 3/3/00 4:46:49 AM Eastern Standard Time, 
[EMAIL PROTECTED] writes:

> Hi
>  
>  I've taken a project created with "Palm C App" stationary, and converted it
>  to a "Palm C++" stationary project.(i.e created a standard Palm C++ 
project,
>  and replaced the default source files with those from my Palm C project)
>  My project also includes a static library, which I created, that contains
>  usefull Utility functions. When  the compiler tried to link my app, I got 
an
>  error saying that one of the functions in my Utility library was undefined.
>  Anyway to cut a long story short, I figured out that If do the following to
>  my Utility libraries header file, then the error went away (I got this by
>  looking at the Palm OS headers)
>  
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
>  
>  foo FooBar(Bar bar);
>  ... nextFunction();
>  ....etc();
>  
>  #ifdef __cplusplus
>  }
>  #endif
>  
>  My question is, what is the significance of  'extern "C"
>  functionPrototypes   }'

'extern "C"' has the effect of preventing name mangling.  Name mangling is 
used by C++ compilers to allow function overloading and works by building in 
the function's parameters and return type into the function name that the 
linker goes by.  You'll find that many third-party libraries use 'extern "C"' 
because it is a way to ensure some independence from the compiler that you 
are using because there is no standard for how a compiler implements its 
mangling.  For example, the mangled names generated by VC++ and Borland are 
different and this is one reason why an exported class from a VC++ DLL 
doesn't work with a Borland EXE (along with case sensitivity differences, I 
think).
-Pete

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to