FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 06-28-2010, 07:16 PM
Ratnam Tatavarty
 
Default Extensions in C++

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 CPPare 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 declarationdefs.h:2967: error: expected ‘;’ before ‘typename’
Thanks and Regads,Â*
Ratnam
--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 06-28-2010, 07:44 PM
Alex Sidorenko
 
Default Extensions in C++

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: asid@hp.com
WTEC Linux Hewlett-Packard (Canada)
------------------------------------------------------------------

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 06-28-2010, 08:12 PM
Ratnam Tatavarty
 
Default Extensions in C++

Hi Alex,Â*Thanks for the clarification. Sticking to plain C looks like a good option formaintainable code in this case. But any future plans to refactor code to makeCrash 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 <asid@hp.com> 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: asid@hp.com

WTEC Linux Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â*Hewlett-Packard (Canada)

------------------------------------------------------------------



--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 10:13 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org