In article <84342@palm-dev-forum>, [EMAIL PROTECTED] says...
> 
> I cannot find reference to this anywhere, but is it possible to use C++
> files in a Shared Library?  It seems when I start to add cpp files to my
> Shared Library project I get a linker error:
> 
> Link Error   : __RuntimeModule__: Entry Point '__InitCode__' is undefined.
> 
> Can I combine both C and C++ files in a Shared Library?

C++ code isn't going to work very well in a shared library?

Why?  Here's three reasons:

1) Shared libraries don't have global variables, so no virtual function 
tables, exceptions, or RTTI.

2) Calls into shared library routines have a required first parameter 
that is the library reference number.  C++ method calls have an implicit 
first parameter than is the this pointer.  Result: C++ methods can't be 
exported as shared library calls.

3) Shared libraries aren't initialized through the CodeWarrior runtime.  
No static object initialization, and since there are no globals, no 
stack of objects to destroy when the library is closed.  (This is the 
source of the __InitCode__ error you're seeing above).

You can use C++ source files with a shared library, but some of the 
language features just don't get along well with the shared library 
runtime model.

-- 
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Get help at http://palmoswerks.com/

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

Reply via email to