This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: linking to changed header file


The class definition in the header file defines a physical structure or
layout for that class that the compiler will use when using that class -
i.e., calling methods on that class, etc.  Virtual functions contribute
to that structure.  By commenting that method out in the header file,
you are changing the internal structure of that class, making it
incompatible with what has already been compiled into the library.

Basically, you can't do that.

Thanks,
Lyle

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Devender Marri
Sent: Thursday, June 03, 2004 1:13 AM
To: gcc-help@gcc.gnu.org
Subject: linking to changed header file

> Hi All,
> 
> I want some explanation regarding a problem which I faced recently, so
thought of posting my query over here so that
> I can get some explanation from a c++ expert.
> 
> My query:
> I am having a third party software, and they provide me with header
files and .so(dymamic link libraries), take note that 
> I do not have any implementation file.
> 
> I had changed one of the header files due to some purpose and the
change I made is I had commented one of the 
> method
> Class Action
> {
>     //virtual void setRequestId(int id);   //my change to the actual
header file
>     virtual void setActionId(int id);
>     virtual int actionId() const;
> 
> }
> 
> I had used the changed header file to compile my codes and link to the
library which the third party software provided.
> 
> example
> int main (){
>     Action act;
>     act.setActionId(100);
>     cout << "action id is " << atc.actionId() << endl;
> }
> Output:
> action id is 0
> 
> I found that my code's are not working as expected, but If I undo the
changes to the third party software I found my codes are working
properly.
> 
> I wish some one will give me some satisfying answer, I appreciate
everyone for answering my query.
> 
> 
> Regards
> Marri Devender Rao
> Software Engineer
> 24, Ang Mo Kio Street 65,
> Singapore 569061
> Phone: 64131381(O), 65833061(H)
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]