Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #101511

Re: linking precedence rules

From Michael Holiday <Mike@example.invalid>
Newsgroups comp.lang.c
Subject Re: linking precedence rules
Date 2017-01-12 03:25 -0800
Message-ID <edp7d7FsineU1@mid.individual.net> (permalink)
References <ede98fF7fvnU1@mid.individual.net> <edeb2qF4e1sU1@mid.individual.net> <edef9tF8tn5U1@mid.individual.net> <e82a98ab-989f-7a52-22e7-5d66d374b0ff@verizon.net>

Show all headers | View raw


On 1/8/2017 8:08 AM, James R. Kuyper wrote:
> On 01/08/2017 04:32 AM, Michael Holiday wrote:
>> On 1/8/2017 12:20 AM, Ian Collins wrote:
> ...
>> Ok. I asked this question wrong. It's not about headers but rather the
>> linking. I think I should have asked what the precedence rules are for
>> the -L tag:
>>
>> LDDLFLAGS = -mdll -s -L"C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib"
>> -static-libgcc -static-libstdc++
>> LDFLAGS = -s -L"C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib"
>
> Note that LDDLFLAGS and LDFLAGS have no special meaning for gcc. Your
> directory names suggest that you're using a Windows system, so I'm not
> sure what significance those names have on your system, but on typical
> Unix-like systems, LDFLAGS is significant in the default rules used by
> the make routine. The following lines were extracted from the default
> make rules on my system:
>
>     LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
>
>     %: %.c
>     #  commands to execute (built-in):
>         $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
>
> I would presume that your system does something comparable with LDDLFLAGS.

Alright, so LDDLFLAGS is implementation-specific. Which implementation? 
windows, gnu, perl, or mingw? (Yes, I am that clueless on getting this 
linked when it doesn't happen easily.)

I thought BartC's thread regarding "have we forgotten how to program?" 
was equal parts interesting and challenging. I have a problem described 
there: not having a module build automatically using cpan and after 
weeks in this rabbit hole, I find my first output. It's crushing me, and 
fates simply have it that I don't have linux on this machine right now, 
so I'm stuck on windows 10.

I've got all the pieces to put this thing together, I just need to link 
it to an updated mingw install. Apparently mingw 3.4.5 is pretty old 
now, and I find no easy means to update as a strawberry perl user.
>
>> Also, there is no C:\STRAWB~1\perl\lib\CORE directory, which makes me
>> think I need to link that with something real.
>
> This is also something that is specific to the particular compiler
> you're using, and is best asked in compiler-specific forum. The man page
> for gcc on the computer I'm currently using says:
>
> "You can mix options. For the most part, the order you use doesn’t
> matter.  Order does matter when you use several options of the same
> kind; for example, if you specify -L more than once, the directories are
> searched in the order specified.  Also, the placement of the -l option
> is significant."
>
> Re: -l:
> "The directories searched include several standard system directories
> plus any that you specify with -L."
>
> "Note that you can also specify places to search using options such as
> -B, -I and -L.  These take precedence over places specified using
> environment variables, which in turn take precedence over those
> specified by the configuration of GCC." For -L, the relevant environment
> variable is LIBRARY_PATH.
>
> Based upon my actual experience with gcc, a given -L option is used only
> when resolving external links while processing files that are specified
> after the -L option. This applies equally to source code files, object
> files, libraries specified with a full path, and libraries specified
> using -l. Thus, given the following command line:
>
> gcc -L/A main.c -L/B subroutine.o -L/C /usr/lib/libXi.so.6 -L/D -lmylib
>
> When resolving external links in main.c, it searches /A. When resolving
> them in subroutine.o, it search /A, and /B, in that order. When
> resolving them in libXi.so.6, it searches in /A, /B, and /C, in that
> order. It searches for libmylib.a (or .so), and any external links
> referred to by that library, in /A, /B, /C, and /D, in that order. In
> each of those cases, it then searches and places specified by
> LIBRARY_PATH, and those specified during the configuration of gcc, in
> that order (I have not actually tested this).

ok. I read that as gnu's linker finding linking libraries from left to 
right without replacement.

I believe this is where I need be finding headers. Is it also what the 
linker needs?

C:\MinGW>findstr /s SYMBOLIC_LINK_FLAG_DIRECTORY *.h
include\winbase.h:#define SYMBOLIC_LINK_FLAG_DIRECTORY  0x1
include\winbase.h:#define SYMBOLIC_LINK_FLAG_DIRECTORY 0x1

C:\MinGW>

Also, is that defined as 1?
-- 
Michael

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-07 23:49 -0800
  Re: linking precedence rules Ian Collins <ian-news@hotmail.com> - 2017-01-08 21:20 +1300
    Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-08 01:32 -0800
      Re: linking precedence rules "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-08 11:08 -0500
        Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-12 03:25 -0800
          Re: linking precedence rules Noob <root@127.0.0.1> - 2017-01-12 13:31 +0100
            OT Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-14 01:18 -0800
      Re: linking precedence rules Barry Schwarz <schwarzb@dqel.com> - 2017-01-08 15:38 -0800
        Re: linking precedence rules "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-08 18:46 -0500
        Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-12 04:13 -0800
          Re: linking precedence rules Richard Heathfield <rjh@cpax.org.uk> - 2017-01-12 12:21 +0000
            Re: linking precedence rules Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-15 00:23 -0800
              Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-16 06:20 -0800
                Re: linking precedence rules Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-30 05:10 -0800
              Re: linking precedence rules Manfred <noname@invalid.add> - 2017-02-04 17:12 +0100
                Re: linking precedence rules Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-08 20:47 -0800
          Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-12 13:31 +0000
            Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-13 01:58 -0800
              Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-13 10:41 +0000
                Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-14 03:49 -0800
                Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 12:03 +0000
                Re: linking precedence rules David Brown <david.brown@hesbynett.no> - 2017-01-14 14:02 +0100
                Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 13:46 +0000
                Re: linking precedence rules gazelle@shell.xmission.com (Kenny McCormack) - 2017-01-14 14:23 +0000
                Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-14 14:31 +0000
                Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 16:18 +0000
                Re: linking precedence rules David Brown <david.brown@hesbynett.no> - 2017-01-14 17:49 +0100
                Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 17:21 +0000
                Re: linking precedence rules Ian Collins <ian-news@hotmail.com> - 2017-01-15 10:12 +1300
                Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-14 21:59 +0000
                Re: linking precedence rules supercat@casperkitty.com - 2017-01-14 14:12 -0800
                Re: linking precedence rules Ian Collins <ian-news@hotmail.com> - 2017-01-15 11:39 +1300
                Re: linking precedence rules Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-01-14 16:03 -0800
                Re: linking precedence rules raltbos@xs4all.nl (Richard Bos) - 2017-01-18 11:51 +0000
                Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-15 02:04 -0800
                Re: linking precedence rules David Brown <david.brown@hesbynett.no> - 2017-01-14 23:48 +0100
                Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-14 20:28 +0000
                The Unix way vs. the Windows way (Was: linking precedence rules) gazelle@shell.xmission.com (Kenny McCormack) - 2017-01-14 14:14 +0000
                Re: The Unix way vs. the Windows way (Was: linking precedence rules) BartC <bc@freeuk.com> - 2017-01-14 14:29 +0000
                Re: The Unix way vs. the Windows way (Was: linking precedence rules) supercat@casperkitty.com - 2017-01-14 14:20 -0800
                Re: linking precedence rules Michael Holiday <Mike@example.invalid> - 2017-01-15 01:40 -0800
                Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-15 11:43 +0000
                Re: linking precedence rules antispam@math.uni.wroc.pl - 2017-01-18 19:55 +0000
                Re: linking precedence rules Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-14 14:22 +0000
              Re: comparison logic Noob <root@127.0.0.1> - 2017-01-13 16:05 +0100
                Re: comparison logic Richard Heathfield <rjh@cpax.org.uk> - 2017-01-13 15:37 +0000
                Re: comparison logic Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-13 16:06 +0000
                Re: comparison logic Noob <root@127.0.0.1> - 2017-01-13 19:37 +0100
                Re: comparison logic BartC <bc@freeuk.com> - 2017-01-13 18:42 +0000
                Re: comparison logic Richard Heathfield <rjh@cpax.org.uk> - 2017-01-13 18:49 +0000
                Re: comparison logic Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-13 20:50 +0000
                Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-14 01:05 -0800
                Re: comparison logic Michael Holiday <Mike@example.invalid> - 2017-01-14 01:27 -0800
                Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-01-14 13:56 -0800
                Re: comparison logic Richard Heathfield <rjh@cpax.org.uk> - 2017-01-15 14:45 +0000
                Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-15 20:42 -0800
                Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-01-15 21:04 -0800
                Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-01-30 04:47 -0800
                Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-01-30 11:40 -0800
                Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-03 16:42 -0800
                Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-02-03 18:45 -0800
                Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-08 21:03 -0800
                Re: comparison logic supercat@casperkitty.com - 2017-02-09 08:07 -0800
                Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-02-09 08:50 -0800
                Re: comparison logic supercat@casperkitty.com - 2017-02-09 12:15 -0800
                Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-02-09 12:38 -0800
                Re: comparison logic supercat@casperkitty.com - 2017-02-09 14:13 -0800
                Re: comparison logic Keith Thompson <kst-u@mib.org> - 2017-02-09 14:45 -0800
                Re: comparison logic Tim Rentsch <txr@alumni.caltech.edu> - 2017-02-12 10:20 -0800
          Re: linking precedence rules BartC <bc@freeuk.com> - 2017-01-12 14:32 +0000
          Re: linking precedence rules James Kuyper <jameskuyper@verizon.net> - 2017-01-12 13:33 -0500

csiph-web