Unix Programming - Re: Need to link shared objects after changing source code but not

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > Re: Need to link shared objects after changing source code but not





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Need to link shared objects after changing source code but not
Chuck Dillon

2004-01-23, 4:51 pm

Sebastian Wagner wrote:
quote:

> Hi!
>
> In our company we have a big c++ software project devided into several
> shared object libs. several programs link particular so's to
> executables.
>
> my question is: assuming that the .h files don't change but only the
> .cpp files and maybe some compilerflags: is it necessarry to re_link_
> the executables after building a new .so file?
>



Linking to a .so just resolves references to symbols that are used by
the program (or other libraries). So if your new .so build doesn't
change or remove any of the symbols that the program (or other .sos)
resolved when it was linked then the program will execute without
relinking.

For example, you could build a skeleton version of an API what does
nothing (i.e. stubs) but can be built to a .so. Then you could link
programs against that .so containing stubs. When you replace the stub
version with a fully implemented version the programs will run, no
linking necessary.

Of course, if you change the interface to the .so from what it was when
the program was *compiled* then it will still run but unpredictable
results can be predicted.

-- ced


--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.

Chuck Dillon

2004-01-23, 4:51 pm

Sebastian Wagner wrote:
quote:

> Hi!
>
> In our company we have a big c++ software project devided into several
> shared object libs. several programs link particular so's to
> executables.
>
> my question is: assuming that the .h files don't change but only the
> .cpp files and maybe some compilerflags: is it necessarry to re_link_
> the executables after building a new .so file?
>



Linking to a .so just resolves references to symbols that are used by
the program (or other libraries). So if your new .so build doesn't
change or remove any of the symbols that the program (or other .sos)
resolved when it was linked then the program will execute without
relinking.

For example, you could build a skeleton version of an API what does
nothing (i.e. stubs) but can be built to a .so. Then you could link
programs against that .so containing stubs. When you replace the stub
version with a fully implemented version the programs will run, no
linking necessary.

Of course, if you change the interface to the .so from what it was when
the program was *compiled* then it will still run but unpredictable
results can be predicted.

-- ced


--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.

Chuck Dillon

2004-01-23, 5:01 pm

Sebastian Wagner wrote:
quote:

> Hi!
>
> In our company we have a big c++ software project devided into several
> shared object libs. several programs link particular so's to
> executables.
>
> my question is: assuming that the .h files don't change but only the
> .cpp files and maybe some compilerflags: is it necessarry to re_link_
> the executables after building a new .so file?
>



Linking to a .so just resolves references to symbols that are used by
the program (or other libraries). So if your new .so build doesn't
change or remove any of the symbols that the program (or other .sos)
resolved when it was linked then the program will execute without
relinking.

For example, you could build a skeleton version of an API what does
nothing (i.e. stubs) but can be built to a .so. Then you could link
programs against that .so containing stubs. When you replace the stub
version with a fully implemented version the programs will run, no
linking necessary.

Of course, if you change the interface to the .so from what it was when
the program was *compiled* then it will still run but unpredictable
results can be predicted.

-- ced


--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.

Chuck Dillon

2004-01-23, 5:17 pm

Sebastian Wagner wrote:
quote:

> Hi!
>
> In our company we have a big c++ software project devided into several
> shared object libs. several programs link particular so's to
> executables.
>
> my question is: assuming that the .h files don't change but only the
> .cpp files and maybe some compilerflags: is it necessarry to re_link_
> the executables after building a new .so file?
>



Linking to a .so just resolves references to symbols that are used by
the program (or other libraries). So if your new .so build doesn't
change or remove any of the symbols that the program (or other .sos)
resolved when it was linked then the program will execute without
relinking.

For example, you could build a skeleton version of an API what does
nothing (i.e. stubs) but can be built to a .so. Then you could link
programs against that .so containing stubs. When you replace the stub
version with a fully implemented version the programs will run, no
linking necessary.

Of course, if you change the interface to the .so from what it was when
the program was *compiled* then it will still run but unpredictable
results can be predicted.

-- ced


--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com