RE: linking to changed header file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
Behalf Of Devender Marri
Sent: Thursday, June 03, 2004 1:13 AM
To: gcc-help@xxxxxxxxxxx
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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux