public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Jeff Lu" <jklcom@mindspring.com>
To: "Charles S. Wilson" <cwilson@ece.gatech.edu>
Cc: <cygwin@sourceware.cygnus.com>
Subject: RE: Question
Date: Tue, 24 Oct 2000 09:50:00 -0000	[thread overview]
Message-ID: <NDBBIHPECLIGKCCLMACAOEHLCHAA.jklcom@mindspring.com> (raw)
In-Reply-To: <39F5B820.41EBF387@ece.gatech.edu>

Thanks Chuck,

I want to link with dll but couldn't get it to work

I was able to compile and link with the static lib
# compile
gcc -o getdata.o -c getdata.c -DGDBM_STATIC
gcc -o utils.o   -c utils.c   -DGDBM_STATIC

#link
gcc -static -o /home/jeff/getdata.cgi getdata.o utils.o -lgdbm

but not with this long command
gcc -static -o /home/jeff/getdata.cgi getdata.c -lgdbm utils.c -DGDBM_STATIC


-----Original Message-----
From: Charles S. Wilson [ mailto:cwilson@ece.gatech.edu ]
Sent: Tuesday, October 24, 2000 12:26 PM
To: Jeff Lu
Cc: cygwin@sourceware.cygnus.com
Subject: Re: Question




Jeff Lu wrote:
>
> I compiled it with CFLAGS=-DGDBM_STATIC such as this
> gcc -o /home/jeff/getdata.cgi getdata.c -lgdbm utils.c -DGDBM_STATIC
>
> This takes care of the rename problem but am still getting dbm_open,
> dbm_fetch etc. as undefined reference
>
> I've even tried to explicitly link it to /usr/lib/libgdbm.a but that
didn't
> help
>

Okay, so it appears that you want to link statically and not use the
dll, right?  You can do this because the gdbm package provides *both* a
static lib *AND* a dll+import library.

If you want to link statically, then you need to add "-static" to your
link command.  Now, since you are going straight from .c files to an
executable all in one step, your compile command and your link command
are the same.  So, do this:

gcc -static -o /home/jeff/getdata.cgi getdata.c -lgdbm utils.c
-DGDBM_STATIC

You could also do this:

# compile
gcc -o getdata.o -c getdata.c -DGDBM_STATIC
gcc -o utils.o   -c utils.c   -DGDBM_STATIC

#link
gcc -static -o /home/jeff/getdata.cgi getdata.o utils.o -lgdbm

but not with this long command
gcc -static -o /home/jeff/getdata.cgi getdata.c -lgdbm utils.c -DGDBM_STATIC



--Chuck


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

  reply	other threads:[~2000-10-24  9:50 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-23 15:22 Question Jeff Lu
2000-10-23 15:55 ` Question Larry Hall (RFK Partners, Inc)
2000-10-23 17:29 ` Question Charles S. Wilson
2000-10-24  8:11   ` Question Jeff Lu
2000-10-24  9:26     ` Question Charles S. Wilson
2000-10-24  9:50       ` Jeff Lu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-05-23 17:40 question Daniel Vasquez
     [not found] <E28B31B71CD3A44E8F32E8D31173B03B32E6DA@goadm.gesforosmos.com>
2003-05-23 17:27 ` question Igor Pechtchanski
2002-09-21 15:33 Question Nuno C Martins
2002-09-21 18:33 ` Question Christopher Faylor
2002-07-19  8:20 Question Vince Hoffman
     [not found] <00e001c22e98$ea2c3e70$0100a8c0@george.co.uk>
2002-07-18 18:15 ` Question Nicholas Wourms
2002-07-19  4:06   ` Question Jim George
2002-07-19  5:49     ` Question Robert Collins
2002-07-19  6:15       ` Question Jim George
2002-07-19  5:49     ` Question Robert Collins
2002-07-18  6:23 Question sanchez_jl
2002-07-18  7:47 ` Question Nicholas Wourms
2002-05-21  8:05 Question corey grimes
2002-05-21  8:08 ` Question Michael A Chase
2002-05-09 14:35 Question Michael Labhard
2002-05-09 14:42 ` Question Michael Labhard
2002-04-24 14:11 question yanniv
2002-04-24 14:20 ` question Keith Seitz
     [not found] <Pine.LNX.4.33.0202141747190.29634-100000@hp.fciencias.unam .mx>
2002-02-15  8:28 ` Question Randall R Schulz
2002-02-14 15:49 Question Cesar Escobar Maya
     [not found] <A74EDD958AFBD311BC56009027E29BC401DD781A@GFS_MAIL01.brentwoo>
2002-01-03  7:06 ` Question Timothy Flechtner
2002-01-03 19:13   ` Question Mike Fahlbusch
2002-01-04  8:54     ` Question Christopher Faylor
2002-01-03  6:45 Question Dwayne "Doc" Sans
     [not found] <004501c0d3fc$bd3bb500$0400020a@tomclauser>
2001-05-14 20:03 ` Question rpaul
     [not found] <F121WMJ69ik6kvXsn2Y00003c75@hotmail.com>
2001-05-07 18:28 ` question Jason Tishler
2001-05-04  8:06 Question Diedrich, David
2001-05-04  8:17 ` Question Michael Erdely
2001-03-28  3:56 Question Ed Day
2001-03-28  4:02 ` Question Corinna Vinschen
2000-11-26  9:29 question Andrew Makhorin
2000-11-26  9:40 ` question Charles S. Wilson
2000-10-21 18:13 Question Jeff Lu
2000-10-18  5:49 Question Kern Sibbald
2000-10-18  7:41 ` Question Larry Hall (RFK Partners, Inc)
2000-10-03 19:04 Question Jeff Lu
2000-08-11 11:52 Question Hong, Ki H
2000-06-23  5:36 Question Earnie Boyd
2000-06-23  4:22 Question Дмитрий Паньков
2000-06-23  6:49 ` Question Tim Prince
2000-04-11  6:00 Question Earnie Boyd
2000-04-10 21:09 Question Joseph Joy
1999-08-04 18:01 question Stefan ZUchlinski
1999-08-04 18:15 ` question Suhaib M. Siddiqi
1999-08-31 23:49   ` question Suhaib M. Siddiqi
1999-08-31 23:49 ` question Stefan ZUchlinski
1999-07-06  8:41 question Marco Hofmann
1999-07-31 18:34 ` question Marco Hofmann
1998-07-17 18:55 Question JSONCRAIG
1998-07-15 12:11 question Liu Yushu
1998-07-08  0:15 Question Marcel R.
1998-07-09 13:22 ` Question Michael Hirmke
1998-07-09 13:22 ` Question Stipe Tolj
1998-07-10 16:03   ` Question Thomas R. Hamsher
     [not found] ` <3.0.5.32.19980709085408.00af0100@pop.ma.ultranet.com>
1998-07-09 13:22   ` Question Marcel R.
1998-07-09 19:48 ` Question Michael Weiser
1998-07-12  4:57   ` Question Ben Elliston
1998-07-12 13:57     ` Question Michael Weiser
1998-01-26 13:35 Question Christopher Hahn
1997-11-24  2:09 question Pavel Tzekov
1997-11-21 10:28 question Earnie Boyd
1997-11-20 19:53 question Andrew or Yssa DeWoody
1997-06-24  6:04 About your web page NetMagic
1997-06-24  9:39 ` Question Jeremy Blackman
1997-05-13  0:57 Question jman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=NDBBIHPECLIGKCCLMACAOEHLCHAA.jklcom@mindspring.com \
    --to=jklcom@mindspring.com \
    --cc=cwilson@ece.gatech.edu \
    --cc=cygwin@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).