Hi Alex, Thanks for the clarification. Sticking to plain C looks like a good option for maintainable code in this case. But any future plans to refactor code to make Crash compatible with CPP would be very helpful - as polymorphism/overloading can be used to work with kernel structures and accessing their members.
Thanks and Regards, Ratnam On Mon, Jun 28, 2010 at 12:44 PM, Alex Sidorenko <[email protected]> wrote: > 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’ > > Hi Ratnam, > > 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: [email protected] > WTEC Linux Hewlett-Packard (Canada) > ------------------------------------------------------------------ >
-- Crash-utility mailing list [email protected] https://www.redhat.com/mailman/listinfo/crash-utility
