Hi Alex,
Hi Ratnam,On June 28, 2010 03:16:32 pm Ratnam Tatavarty wrote:
> Hi,
> I am looking for a way to code/compile my Crash tool extension .so in CPP.
> During compile step, I hit a name collision with "namespace" keyword upon
> including defs.h. Does anyone try any CPP extensions before and if yes are
> there any guidelines/suggestions about the required changes, compile
> options? Any insights about Crash compatibility with CPP are greatly
> appreciated.
>
> Build errors:
>
> defs.h:1917: error: expected identifier before ‘namespace’
> defs.h:1917: error: expected unqualified-id before ‘namespace’
> defs.h:1956: error: expected identifier before ‘namespace’
> ...
> defs.h:2967: error: expected unqualified-id before ‘typename’
> defs.h:2967: error: abstract declarator ‘char*’ used as declaration
> defs.h:2967: error: expected ‘;’ before ‘typename’
I think that building extensions in C++ for crash should just follow the
standard guidelines for linking C/C++ code together. This is relatively easy
when main program is implemented in C++ - just put the needed headers in your
C++ programs in
extern "C" {
...
}
sections. But in our case it is different - the main program (crash) is
implemented in C. To make C++ work properly, you need to call special
initialization subroutines explicitly (e.g. those for ctors and dtors). This
is very compiler and library dependent. I remember doing such things on HPUX
with aCC. I think the same can be done on Linux with GCC/G++ but it will
depend on compiler version.
Regards,
Alex
--
------------------------------------------------------------------
Alexandre Sidorenko email: asid@hp.com
WTEC Linux Hewlett-Packard (Canada)
------------------------------------------------------------------