<?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: Undefined symbol linking C code with static library in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815430#M34332</link>
    <description>Re points see &lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I think Simon has covered it. I am told that on  unix you can get away with this i.e lots of references but no definition. On VMS you have to declare it once somewhere. You could use the /INCLUDE=BASE.OBJ qualifier on the LINK paramter that specifies the library to force the inclusion of the object mode that defines the variable.&lt;BR /&gt;&lt;BR /&gt;The extern model specified to the compiler also influences this. RTF for the gory details.&lt;BR /&gt;&lt;BR /&gt;On VMS I64 the rules are different.</description>
    <pubDate>Fri, 30 Jun 2006 03:20:43 GMT</pubDate>
    <dc:creator>Ian Miller.</dc:creator>
    <dc:date>2006-06-30T03:20:43Z</dc:date>
    <item>
      <title>Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815415#M34317</link>
      <description>&lt;!--!*#--&gt;I have an undefined symbol warning in one of a set of C programs, each of which links to the same single object library.  When linked with an equivalent shared image library, there is no such warning.&lt;BR /&gt;&lt;BR /&gt;One difference I have noticed is that in all of the successful links, there was a selective search of SYS$COMMON:[SYSLIB]SYS$PUBLIC_VECTORS.EXE.  The map of the link with the warning shows no reference to PUBLIC_VECTORS.EXE.&lt;BR /&gt;&lt;BR /&gt;Is that difference likely significant in my undefined symbol problem?  Can anyone suggest what may be going on?</description>
      <pubDate>Thu, 29 Jun 2006 19:34:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815415#M34317</guid>
      <dc:creator>Susan Abercrombie</dc:creator>
      <dc:date>2006-06-29T19:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815416#M34318</link>
      <description>What's the symbol that is not resolved?</description>
      <pubDate>Thu, 29 Jun 2006 20:28:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815416#M34318</guid>
      <dc:creator>Robert Brooks_1</dc:creator>
      <dc:date>2006-06-29T20:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815417#M34319</link>
      <description>I should have stated that the object library is not a system library.&lt;BR /&gt;&lt;BR /&gt;The undefined symbol is a variable named _libGlobal__, which is declared extern in a header file included in many of the modules in the object library.  It is an instance of a named typedef struct declared in the same header.&lt;BR /&gt;&lt;BR /&gt;A member of the struct is used in a #define of a symbol IS_LOG_EXACT_TIME, which is referenced in a function called _LogTime.  That function is defined in a module named derror.c which #includes the header.&lt;BR /&gt;&lt;BR /&gt;The linker finds _LogTime, but it doesn't find _libGlobal__.</description>
      <pubDate>Thu, 29 Jun 2006 21:51:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815417#M34319</guid>
      <dc:creator>Susan Abercrombie</dc:creator>
      <dc:date>2006-06-29T21:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815418#M34320</link>
      <description>&lt;!--!*#--&gt;I got lost in that description, but in the&lt;BR /&gt;problem program, is _libGlobal__ ever&lt;BR /&gt;declared _other_ than as an extern (in the&lt;BR /&gt;header file)?  (Perhaps in the main program?)&lt;BR /&gt;I'd guess that it _is_ in the non-problem&lt;BR /&gt;programs.&lt;BR /&gt;&lt;BR /&gt;alp $ type a1.c&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;&lt;BR /&gt;extern int ext;         /* Pretend that this is in a header file. */&lt;BR /&gt;&lt;BR /&gt;extern int a2( void);&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;    ext = 1;&lt;BR /&gt;    printf( " ext = %d.  A2 says %d.\n", ext, a2());&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;alp $ type a2.c&lt;BR /&gt;&lt;BR /&gt;extern int ext;         /* Pretend that this is in a header file. */&lt;BR /&gt;&lt;BR /&gt;int a2()&lt;BR /&gt;{&lt;BR /&gt;    return ext;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;alp $ cc a1&lt;BR /&gt;alp $ cc a2&lt;BR /&gt;alp $ link a1, a2&lt;BR /&gt;%LINK-W-NUDFSYMS, 1 undefined symbol:&lt;BR /&gt;%LINK-I-UDFSYM,         EXT&lt;BR /&gt;%LINK-W-USEUNDEF, undefined symbol EXT referenced&lt;BR /&gt;        in psect $LINK$ offset %X00000028&lt;BR /&gt;        in module A1 file ALP$DKA0:[SMS]A1.OBJ;3&lt;BR /&gt;%LINK-W-USEUNDEF, undefined symbol EXT referenced&lt;BR /&gt;        in psect $LINK$ offset %X00000010&lt;BR /&gt;        in module A2 file ALP$DKA0:[SMS]A2.OBJ;2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;alp $ type a3.c&lt;BR /&gt;&lt;BR /&gt;int ext;                /* Note: NOT extern. */&lt;BR /&gt;&lt;BR /&gt;alp $ cc a3&lt;BR /&gt;alp $ link a1, a2, a3&lt;BR /&gt;&lt;BR /&gt;alp $ r a1&lt;BR /&gt; ext = 1.  A2 says 1.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It's not enough to say "extern int ext;"&lt;BR /&gt;everywhere.  _Someone_ needs to declare&lt;BR /&gt;"ext" simply, to get some storage allocated&lt;BR /&gt;for it.  In real life, no one would be likely&lt;BR /&gt;to declare "ext" in its own module this way,&lt;BR /&gt;but it does need to be declared _somewhere_.&lt;BR /&gt;&lt;BR /&gt;In other words, "extern" tells the linker&lt;BR /&gt;that it exists elsewhere, but someone,&lt;BR /&gt;somewhere, needs to take responsibility and&lt;BR /&gt;actually make the thing.&lt;BR /&gt;&lt;BR /&gt;Or else I misunderstand this whole thing.&lt;/STDIO.H&gt;</description>
      <pubDate>Thu, 29 Jun 2006 22:33:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815418#M34320</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-06-29T22:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815419#M34321</link>
      <description>Yes, it's easy to get lost in...&lt;BR /&gt;&lt;BR /&gt;The variable itself is declared in BASE, a module in the object library, but not in the module DERROR which contains the function in which the linker reports the undefined symbol.  It is never declared in the programs I'm compiling and linking with the library.&lt;BR /&gt;&lt;BR /&gt;I have been scanning maps and listings, and noticed that there is nothing in the offending program which calls any function within BASE.  There *is* a call to one or more functions in BASE in all the other programs.&lt;BR /&gt;&lt;BR /&gt;The header makes the variable extern, and is included wherever there is any reference to the variable (either explicitly or via #defined symbols), including BASE.&lt;BR /&gt;&lt;BR /&gt;There is no problem when I link to a shared image version of the library rather than the object library.  The symbol_vector list for the shared image library link contains only functions.&lt;BR /&gt;&lt;BR /&gt;I don't see why a function reference within BASE should be required in order to access an extern variable declared with file scope in BASE.  But that seems to be so.  If I insert such a reference into the problem program, the problem goes away.&lt;BR /&gt;&lt;BR /&gt;What am I missing?  (Besides my mind ;-)</description>
      <pubDate>Thu, 29 Jun 2006 23:03:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815419#M34321</guid>
      <dc:creator>Susan Abercrombie</dc:creator>
      <dc:date>2006-06-29T23:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815420#M34322</link>
      <description>&amp;gt; I don't see why a function reference&lt;BR /&gt;&amp;gt; within BASE should be required in order to&lt;BR /&gt;&amp;gt; access an extern variable declared with&lt;BR /&gt;&amp;gt; file scope in BASE.&lt;BR /&gt;&lt;BR /&gt;Something has to get that module into the&lt;BR /&gt;executable, or else the storage for the&lt;BR /&gt;extern thing will not make it in.&lt;BR /&gt;&lt;BR /&gt;I assume that you could link using something&lt;BR /&gt;like:&lt;BR /&gt;&lt;BR /&gt;link [...] -&lt;BR /&gt; lib_with_base.olb /library /include = base -&lt;BR /&gt;[...]&lt;BR /&gt;&lt;BR /&gt;which should pull in the module without&lt;BR /&gt;requiring some dummy function reference.&lt;BR /&gt;&lt;BR /&gt;I don't do much with shared images, but I&lt;BR /&gt;assume that they're loaded all-or-nothing,&lt;BR /&gt;while, with an object library, the linker&lt;BR /&gt;pulls out only the pieces which it (thinks&lt;BR /&gt;that it) needs.</description>
      <pubDate>Thu, 29 Jun 2006 23:16:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815420#M34322</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-06-29T23:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815421#M34323</link>
      <description>&lt;!--!*#--&gt;That's probably pretty convoluted, too.  Let me try again.&lt;BR /&gt;&lt;BR /&gt;GLOBAL.h contains&lt;BR /&gt;   typedef struct _libGlobal&lt;BR /&gt;      { ... } _libGlobalRec, *_libGlobal;&lt;BR /&gt;   extern _libGlobalRec _libGlobal__;&lt;BR /&gt;   #define IS_LOG_EXACT_TIME (__libGlobal__.debug &amp;amp; (2 &amp;lt;&amp;lt; 0) &lt;BR /&gt;&lt;BR /&gt;MYLIB.olb contains&lt;BR /&gt;   BASE.obj&lt;BR /&gt;      #include "global.h"&lt;BR /&gt;      _libGlobalRec _libGlobal__; /* file scope */&lt;BR /&gt;      &lt;MANY functions=""&gt;&lt;BR /&gt;&lt;BR /&gt;   DERROR.obj&lt;BR /&gt;      #include "global.h"&lt;BR /&gt;      void _LogTime(FILE *fd, char *buf)&lt;BR /&gt;         { if (IS_LOG_EXACT_TIME) ... }&lt;BR /&gt;&lt;BR /&gt;A program which does not call any function within BASE.obj in the library, but which does call stuff which calls stuff which calls _LogTime in DERROR.obj, gets an undefined symbol warning on _libGlobal__.&lt;BR /&gt;&lt;BR /&gt;Add a call to any (I'm guessing -- I've tried three) function from BASE.obj and the problem goes away.&lt;BR /&gt;&lt;BR /&gt;Why? &lt;BR /&gt;&lt;BR /&gt;&lt;/MANY&gt;</description>
      <pubDate>Thu, 29 Jun 2006 23:29:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815421#M34323</guid>
      <dc:creator>Susan Abercrombie</dc:creator>
      <dc:date>2006-06-29T23:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815422#M34324</link>
      <description>Hi Steven,&lt;BR /&gt;&lt;BR /&gt;My attempt to clarify crossed with your last reply.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Something has to get that module into the&lt;BR /&gt;&amp;gt; executable, or else the storage for the&lt;BR /&gt;&amp;gt; extern thing will not make it in.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I assume that you could link using something&lt;BR /&gt;&amp;gt; like:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; link [...] -&lt;BR /&gt;&amp;gt; lib_with_base.olb /library /include = base -&lt;BR /&gt;&amp;gt; [...]&lt;BR /&gt;&lt;BR /&gt;&amp;gt; which should pull in the module without&lt;BR /&gt;&amp;gt; requiring some dummy function reference.&lt;BR /&gt;&lt;BR /&gt;I assumed (apparently incorrectly) that the compiler would generate a list (so to speak) of anything declared extern and created within a module, and the linker would use that (either from the .obj or from the module in the library) and thus be able to resolve any function or any external thing.&lt;BR /&gt;&lt;BR /&gt;This code exists on various platforms.  The problem is not observed on the other operating systems.  It's mine alone, so to speak.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!&lt;BR /&gt;&lt;BR /&gt;Sue&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Jun 2006 23:45:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815422#M34324</guid>
      <dc:creator>Susan Abercrombie</dc:creator>
      <dc:date>2006-06-29T23:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815423#M34325</link>
      <description>Because the only real storage for&lt;BR /&gt;_libGlobal__ is declared/allocated in&lt;BR /&gt;BASE.obj.  If the linker does not get&lt;BR /&gt;BASE.obj out of MYLIB.olb (and into your&lt;BR /&gt;executable), then your executable will not&lt;BR /&gt;get that storage.  Hence, UDFSYM.&lt;BR /&gt;&lt;BR /&gt;Refering to _libGlobal__ one more time (as&lt;BR /&gt;in IS_LOG_EXACT_TIME) does not get BASE.obj&lt;BR /&gt;into the executable.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Add a call [...] and the problem goes away.&lt;BR /&gt;&lt;BR /&gt;Yes, because that _will_ get BASE.obj into&lt;BR /&gt;the executable.  (As will "/include = base"&lt;BR /&gt;in the LINK command.)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This says that it exists somewhere:&lt;BR /&gt;extern _libGlobalRec _libGlobal__;&lt;BR /&gt;&lt;BR /&gt;So everyone believes (at compile time) that&lt;BR /&gt;it exists somewhere.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This makes it exist:&lt;BR /&gt;_libGlobalRec _libGlobal__; /* file scope */&lt;BR /&gt;&lt;BR /&gt;but that's in BASE.obj, so if BASE.obj is not&lt;BR /&gt;linked in, then the storage for _libGlobal__&lt;BR /&gt;does not exist in your executable.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now, if you want the storage to exist without&lt;BR /&gt;bringing in BASE.obj, you'll need to declare&lt;BR /&gt;_libGlobal__ somewhere else.  (But if you&lt;BR /&gt;link together two modules which declare the&lt;BR /&gt;thing, then get ready for a MULDEF.)</description>
      <pubDate>Thu, 29 Jun 2006 23:52:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815423#M34325</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-06-29T23:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815424#M34326</link>
      <description>This may be related to something like "weak"&lt;BR /&gt;versus "strong" references, or some other&lt;BR /&gt;topic about which I never read in the linker&lt;BR /&gt;manual.  I would not be surprised if there&lt;BR /&gt;were some clever way to persuade the linker&lt;BR /&gt;to create this stuff the way you expected it&lt;BR /&gt;to happen, but I always do it the way I've&lt;BR /&gt;suggested (which also seems to work on UNIX&lt;BR /&gt;systems).&lt;BR /&gt;&lt;BR /&gt;Everything's complicated, I always say.</description>
      <pubDate>Fri, 30 Jun 2006 00:00:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815424#M34326</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-06-30T00:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815425#M34327</link>
      <description>Besides, if someone allocated the storage for&lt;BR /&gt;you automatically, and you really wanted it&lt;BR /&gt;to have some fancy attributes (volatile,&lt;BR /&gt;__restrict, __unaligned, or whatever), you'd&lt;BR /&gt;(silently) get what you didn't want, and&lt;BR /&gt;you might never guess what went wrong.  (And,&lt;BR /&gt;more important, whom to blame.)&lt;BR /&gt;&lt;BR /&gt;Yes, I'm sure that this is the best of all&lt;BR /&gt;possible worlds.</description>
      <pubDate>Fri, 30 Jun 2006 00:16:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815425#M34327</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-06-30T00:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815426#M34328</link>
      <description>Well, it's VMS, so it *has* to be the best of all possible worlds, right?&lt;BR /&gt;&lt;BR /&gt;The problem (that is to say, the link warning) doesn't happen on our unix platforms.  From which fact I am informed by my peers that there is something wrong with the way VMS does it.&lt;BR /&gt;&lt;BR /&gt;Thanks very much!&lt;BR /&gt;&lt;BR /&gt;Sue</description>
      <pubDate>Fri, 30 Jun 2006 00:28:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815426#M34328</guid>
      <dc:creator>Susan Abercrombie</dc:creator>
      <dc:date>2006-06-30T00:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815427#M34329</link>
      <description>Tell 'em that _properly_ structured code&lt;BR /&gt;_does_ work the same everywhere.  They&lt;BR /&gt;probably won't believe it, but you have my&lt;BR /&gt;permission to look very smug as you say it.</description>
      <pubDate>Fri, 30 Jun 2006 00:34:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815427#M34329</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-06-30T00:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815428#M34330</link>
      <description>&lt;!--!*#--&gt;Also, it's worse than just a LINK warning.&lt;BR /&gt;The program will ACCVIO at run time:&lt;BR /&gt;&lt;BR /&gt;alp $ link a1, a2&lt;BR /&gt;%LINK-W-NUDFSYMS, 1 undefined symbol:&lt;BR /&gt;%LINK-I-UDFSYM,         EXT&lt;BR /&gt;%LINK-W-USEUNDEF, undefined symbol EXT referenced&lt;BR /&gt;        in psect $LINK$ offset %X00000028&lt;BR /&gt;        in module A1 file ALP$DKA0:[SMS]A1.OBJ;3&lt;BR /&gt;%LINK-W-USEUNDEF, undefined symbol EXT referenced&lt;BR /&gt;        in psect $LINK$ offset %X00000010&lt;BR /&gt;        in module A2 file ALP$DKA0:[SMS]A2.OBJ;2&lt;BR /&gt;&lt;BR /&gt;alp $ run a1&lt;BR /&gt;%SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual address=000000000000&lt;BR /&gt;0000, PC=00000000000200CC, PS=0000001B&lt;BR /&gt;%TRACE-F-TRACEBACK, symbolic stack dump follows&lt;BR /&gt;  image    module    routine             line      rel PC           abs PC&lt;BR /&gt; A1  A1  main                            1600 00000000000000CC 00000000000200CC&lt;BR /&gt; A1  A1  __main                          1598 0000000000000064 0000000000020064&lt;BR /&gt;                                            0 FFFFFFFF80269ED4 FFFFFFFF80269ED4&lt;BR /&gt;alp $&lt;BR /&gt;&lt;BR /&gt;Because, of course, we don't know where that&lt;BR /&gt;extern thing is supposed to be ("VA = 0").</description>
      <pubDate>Fri, 30 Jun 2006 00:37:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815428#M34330</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-06-30T00:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815429#M34331</link>
      <description>In this particular case, I think the probability of _LogTime actually being executed is very small indeed.  However, I absolutely agree that this needs to be fixed with _properly_ structured code. &lt;BR /&gt;&lt;BR /&gt;User code doesn't know or care about _libGlobal__, so it doesn't want to be declared in anybody's main routine.  The fix should be done within the library.&lt;BR /&gt;&lt;BR /&gt;I know nothing of the structure of unix static libraries, so I have no clue what unix does with this situation.&lt;BR /&gt;&lt;BR /&gt;I assumed that ACCVIO would be the result if the function that uses _libGlobal__ actually executed.  I did not try to set up an execution scenario that might make it happen.  &lt;BR /&gt;&lt;BR /&gt;Again, thanks very much!  I will need to figure out how to go about rating solutions!</description>
      <pubDate>Fri, 30 Jun 2006 01:37:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815429#M34331</guid>
      <dc:creator>Susan Abercrombie</dc:creator>
      <dc:date>2006-06-30T01:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815430#M34332</link>
      <description>Re points see &lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I think Simon has covered it. I am told that on  unix you can get away with this i.e lots of references but no definition. On VMS you have to declare it once somewhere. You could use the /INCLUDE=BASE.OBJ qualifier on the LINK paramter that specifies the library to force the inclusion of the object mode that defines the variable.&lt;BR /&gt;&lt;BR /&gt;The extern model specified to the compiler also influences this. RTF for the gory details.&lt;BR /&gt;&lt;BR /&gt;On VMS I64 the rules are different.</description>
      <pubDate>Fri, 30 Jun 2006 03:20:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815430#M34332</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2006-06-30T03:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined symbol linking C code with static library</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815431#M34333</link>
      <description>Susan,&lt;BR /&gt;&lt;BR /&gt;please let me forward some comments (from an informed source):&lt;BR /&gt;&lt;BR /&gt;&lt;QUOTE&gt;&lt;BR /&gt;On VMS I64 the rules are different.&lt;BR /&gt;&lt;/QUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;No.&lt;BR /&gt;&lt;BR /&gt;Without the actual the link command and the options file, this is unlikely to be resolved in this stream.&lt;BR /&gt;&lt;BR /&gt;&lt;QUOTE&gt;&lt;BR /&gt;I have an undefined symbol warning in one of a set of C programs, each of which links to the same single object library.  When linked with an equivalent shared image library, there is no such warning.&lt;BR /&gt;&lt;/QUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;The order of processing the input files is probably different in both cases. The linker manual in chapter 2 explains how symbol resolution works.&lt;BR /&gt;&lt;BR /&gt;&lt;QUOTE&gt;&lt;BR /&gt;The problem (that is to say, the link warning) doesn't happen on our unix platforms. From which fact I am informed by my peers that there is something wrong with the way VMS does it.&lt;BR /&gt;&lt;/QUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;So ask the unix guys to produce a linker map. Then you will see the object module which defines the symbol. Explicitly include that module in your link command and you are done.&lt;BR /&gt;&lt;BR /&gt;Volker.&lt;BR /&gt;&lt;BR /&gt;PS: Just the messenger...</description>
      <pubDate>Sat, 01 Jul 2006 01:04:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/undefined-symbol-linking-c-code-with-static-library/m-p/3815431#M34333</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2006-07-01T01:04:31Z</dc:date>
    </item>
  </channel>
</rss>

