<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Overriding a function and .so priority setting. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518880#M651418</link>
    <description>Thanks a lot once again.&lt;BR /&gt;:)&lt;BR /&gt;&lt;BR /&gt;LD_LIBRARY_PATH des the trick..&lt;BR /&gt;&lt;BR /&gt;Sorry I thought I had clicked on submit points after I had assignd points :|&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;</description>
    <pubDate>Fri, 23 Oct 2009 09:08:37 GMT</pubDate>
    <dc:creator>Wkdunreal</dc:creator>
    <dc:date>2009-10-23T09:08:37Z</dc:date>
    <item>
      <title>Overriding a function and .so priority setting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518875#M651413</link>
      <description>Hello again,&lt;BR /&gt;&lt;BR /&gt;Q1)&lt;BR /&gt;&lt;BR /&gt;Is there a way to override self written functions on HP ux 11.31 ia64?&lt;BR /&gt;&lt;BR /&gt;for example:&lt;BR /&gt;&lt;BR /&gt;in file.c suppose there is function  hello()&lt;BR /&gt;now I want to override this function which I myself had written by another hello().&lt;BR /&gt;&lt;BR /&gt;System calls can be overrided by using LD_PRELOAD and at run time calling our own .so library. &lt;BR /&gt;&lt;BR /&gt;But the same does notseem work for overriding self written fucntions.&lt;BR /&gt;&lt;BR /&gt;Reason for this:&lt;BR /&gt;a particular function was written quite a few years ago .. and now changes cannot be made to it cause many clients have the old version of the function.&lt;BR /&gt;&lt;BR /&gt;So need is to develop a patch with our own new library which overrides the same function.&lt;BR /&gt;&lt;BR /&gt;I have been tryign to fiddle around with "chatr" and using SHLIB_PATH (had got a hint this path might help) but am unable to get the desired results.&lt;BR /&gt;&lt;BR /&gt;Q2)&lt;BR /&gt;suppose I have 2 .so&lt;BR /&gt;2)lib1.so&lt;BR /&gt;2)lib2.so&lt;BR /&gt;&lt;BR /&gt;and the lets say calling function is call.cxx&lt;BR /&gt;when I create a executable using the command&lt;BR /&gt;&lt;BR /&gt;gcc -g call.cxx lib1.so lib2.so -o executable&lt;BR /&gt;&lt;BR /&gt;Is there a way to give lib1.so a higer priority than lib2.so so that if there are common functions in lib1.so and lib2.so with similar definitions but different implementations, the fucntion in lib1.so be used and not the lib2.so .&lt;BR /&gt;&lt;BR /&gt;for example:&lt;BR /&gt;&lt;BR /&gt;lib1.so ----&amp;gt; add()  // returns 3&lt;BR /&gt;lib2.so ----&amp;gt; add()  // returns 4&lt;BR /&gt;&lt;BR /&gt;how can i make the executable so that the add() from lib1.so is used?&lt;BR /&gt;(trying to override the function this way too :) just an idea though)&lt;BR /&gt;&lt;BR /&gt;Thank you all very much in advance :)&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 22 Oct 2009 04:08:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518875#M651413</guid>
      <dc:creator>Wkdunreal</dc:creator>
      <dc:date>2009-10-22T04:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Overriding a function and .so priority setting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518876#M651414</link>
      <description>current values:&lt;BR /&gt;         32-bit ELF executable&lt;BR /&gt;         shared library dynamic path search:&lt;BR /&gt;             LD_LIBRARY_PATH    enabled  first&lt;BR /&gt;             SHLIB_PATH         enabled  second&lt;BR /&gt;             embedded path      enabled  third  /usr/local/lib/gcc/ia64-hp-hpux11.23/4.0.2:/usr/ccs/bin:/usr/ccs/lib:/usr/local/lib&lt;BR /&gt;         shared library list:&lt;BR /&gt;             ./library.so&lt;BR /&gt;             arbasic.so&lt;BR /&gt;             libc.so.1&lt;BR /&gt;         shared library binding:&lt;BR /&gt;             deferred&lt;BR /&gt;         global hash table disabled&lt;BR /&gt;         global hash table size 1103&lt;BR /&gt;         shared library mapped private disabled&lt;BR /&gt;         shared library segment merging disabled&lt;BR /&gt;         shared vtable support disabled&lt;BR /&gt;         explicit unloading disabled&lt;BR /&gt;         linkage table protection disabled&lt;BR /&gt;         segments:&lt;BR /&gt;             index type     address      flags size&lt;BR /&gt;                 8 text     04000000     z---c-    D (default)&lt;BR /&gt;                 9 data     40010000     ---m--    D (default)&lt;BR /&gt;         executable from stack: D (default)&lt;BR /&gt;         kernel assisted branch prediction enabled&lt;BR /&gt;         lazy swap allocation for dynamic segments disabled&lt;BR /&gt;         nulptr dereferences trap enabled&lt;BR /&gt;         address space model: default&lt;BR /&gt;         caliper dynamic instrumentation disabled&lt;BR /&gt;   new values:&lt;BR /&gt;         32-bit ELF executable&lt;BR /&gt;         shared library dynamic path search:&lt;BR /&gt;             LD_LIBRARY_PATH    enabled  first&lt;BR /&gt;             SHLIB_PATH         enabled  second&lt;BR /&gt;             embedded path      enabled  third  /usr/local/lib/gcc/ia64-hp-hpux11.23/4.0.2:/usr/ccs/bin:/usr/ccs/lib:/usr/local/lib&lt;BR /&gt;         shared library list:&lt;BR /&gt;             ./library.so&lt;BR /&gt;             arbasic.so&lt;BR /&gt;             libc.so.1&lt;BR /&gt;         shared library binding:&lt;BR /&gt;             deferred&lt;BR /&gt;         global hash table disabled&lt;BR /&gt;         global hash table size 1103&lt;BR /&gt;         shared library mapped private disabled&lt;BR /&gt;         shared library segment merging disabled&lt;BR /&gt;         shared vtable support disabled&lt;BR /&gt;         explicit unloading disabled&lt;BR /&gt;         linkage table protection disabled&lt;BR /&gt;         segments:&lt;BR /&gt;             index type     address      flags size&lt;BR /&gt;                 8 text     04000000     z---c-    D (default)&lt;BR /&gt;                 9 data     40010000     ---m--    D (default)&lt;BR /&gt;         executable from stack: D (default)&lt;BR /&gt;         kernel assisted branch prediction enabled&lt;BR /&gt;         lazy swap allocation for dynamic segments disabled&lt;BR /&gt;         nulptr dereferences trap enabled&lt;BR /&gt;         address space model: default&lt;BR /&gt;         caliper dynamic instrumentation disabled&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This is the page that i get when I set the SHLIB_PATH using&lt;BR /&gt;&lt;BR /&gt;export SHLIB_PATH&lt;BR /&gt;&lt;BR /&gt;and then do the&lt;BR /&gt;&lt;BR /&gt;chatr enable +s final  (on the ELF file final 32 bit)&lt;BR /&gt;&lt;BR /&gt;but as you see against the SHLIB_PATH , nonew path is set even after setting the SHLIB_PATH.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;any ideas why this might be happening?&lt;BR /&gt;&lt;BR /&gt;Regards and thanks :)</description>
      <pubDate>Thu, 22 Oct 2009 05:45:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518876#M651414</guid>
      <dc:creator>Wkdunreal</dc:creator>
      <dc:date>2009-10-22T05:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Overriding a function and .so priority setting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518877#M651415</link>
      <description>&amp;gt;by using LD_PRELOAD ... But the same does not seem work for overriding self written functions.&lt;BR /&gt;&lt;BR /&gt;Why not?  Note: If your function is called from the same file, you can't override it.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Is there a way to give lib1.so a higher priority than lib2.so&lt;BR /&gt;&lt;BR /&gt;Only by ordering lib1 before lib2.&lt;BR /&gt;&lt;BR /&gt;On Integrity, you should use LD_LIBRARY_PATH instead of SHLIB_PATH.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;but as you see against the SHLIB_PATH, no new path is set even after setting the SHLIB_PATH.&lt;BR /&gt;&lt;BR /&gt;LD_LIBRARY_PATH amd SHLIB_PATH were already enabled, so chatr did nothing.&lt;BR /&gt;&lt;BR /&gt;You need to export LD_LIBRARY_PATH and see what ldd shows you:&lt;BR /&gt;ldd final</description>
      <pubDate>Thu, 22 Oct 2009 09:10:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518877#M651415</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-10-22T09:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Overriding a function and .so priority setting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518878#M651416</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;I checked up creating ELf file by changing the order of the .so files and Viola it indeed did work :)&lt;BR /&gt;&lt;BR /&gt;Thanks a bunch. This has made my headache soothe :D&lt;BR /&gt;&lt;BR /&gt;Also LD_PRELOAD did work on hp ux..&lt;BR /&gt;&lt;BR /&gt;Though on AIX LDR_PRELOAD or LDR_PRELOAD64 didnt seem to work.&lt;BR /&gt;( am doing the same thing on HP-UX 11.31 AIX 5.3  &amp;amp; solaris 10)&lt;BR /&gt;&lt;BR /&gt;Could you explain the last part about exporting LD_LIBRARY_PATH in a bit more detail please? I didnt seem to get it right..&lt;BR /&gt;&lt;BR /&gt;I had exported SHLIB_PATH.&lt;BR /&gt;&lt;BR /&gt;thanks a lot again.&lt;BR /&gt;Was a great help :D</description>
      <pubDate>Fri, 23 Oct 2009 08:24:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518878#M651416</guid>
      <dc:creator>Wkdunreal</dc:creator>
      <dc:date>2009-10-23T08:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Overriding a function and .so priority setting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518879#M651417</link>
      <description>&amp;gt;Could you explain the last part about exporting LD_LIBRARY_PATH in a bit more detail please?  I had exported SHLIB_PATH.&lt;BR /&gt;&lt;BR /&gt;Which part?  Basically SHLIB_PATH is the obsolete PA32 way of doing things whereas LD_LIBRARY_PATH is standard.&lt;BR /&gt;&lt;BR /&gt;If you export them, ldd will tell you which shlibs it will use when you are running the application.&lt;BR /&gt;&lt;BR /&gt;You can read all about ld, dld and shlibs in:&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/14640/OnlineHelp/linkhelp.html" target="_blank"&gt;http://docs.hp.com/en/14640/OnlineHelp/linkhelp.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;thanks a lot again.  Was a great help :D&lt;BR /&gt;&lt;BR /&gt;Pleased read the following about how to assign points:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;</description>
      <pubDate>Fri, 23 Oct 2009 09:03:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518879#M651417</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-10-23T09:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Overriding a function and .so priority setting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518880#M651418</link>
      <description>Thanks a lot once again.&lt;BR /&gt;:)&lt;BR /&gt;&lt;BR /&gt;LD_LIBRARY_PATH des the trick..&lt;BR /&gt;&lt;BR /&gt;Sorry I thought I had clicked on submit points after I had assignd points :|&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Oct 2009 09:08:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/overriding-a-function-and-so-priority-setting/m-p/4518880#M651418</guid>
      <dc:creator>Wkdunreal</dc:creator>
      <dc:date>2009-10-23T09:08:37Z</dc:date>
    </item>
  </channel>
</rss>

