delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/13/18:08:52

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Fri, 13 Apr 2001 18:08:14 -0400
From: Jason Tishler <Jason DOT Tishler AT dothill DOT com>
To: Michael Lemke <lemkemch AT t-online DOT de>
Cc: cygwin AT cygwin DOT com, Pgsql-Ports <pgsql-ports AT postgresql DOT org>
Subject: Re: Postgres 7.1RC4 ecpg can't find sqlca
Message-ID: <20010413180814.U212@dothill.com>
Mail-Followup-To: Michael Lemke <lemkemch AT t-online DOT de>, cygwin AT cygwin DOT com,
Pgsql-Ports <pgsql-ports AT postgresql DOT org>
References: <14oAi6-19LMiuC AT fwd03 DOT sul DOT t-online DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <14oAi6-19LMiuC@fwd03.sul.t-online.com>; from lemkemch@t-online.de on Fri, Apr 13, 2001 at 11:02:23PM +0200
Organization: Dot Hill Systems Corp.

Michael,

On Fri, Apr 13, 2001 at 11:02:23PM +0200, Michael Lemke wrote:
> With the latest postgres release that came lately with cygwin I made my
> very first attempt at writng an ESQL program (actually, at the moment it 
> is just something I dowloaded).  Now when I link it can't find sqlca:
> 
> michael> gcc -I /usr/include/postgresql/  esql.c -lecpg -lpq
> /f/cygwin~1/tmp/ccbnOeiG.o(.text+0x203):esql.c: undefined reference to `sqlca'
> /f/cygwin~1/tmp/ccbnOeiG.o(.text+0x292):esql.c: undefined reference to `sqlca'
> collect2: ld returned 1 exit status
> 
> ecpg made the declaration of sqlca 
> 
>   extern struct sqlca sqlca;

I believe that the above is a bug in sqlca.h.  My WAG (without actually
trying this) is that the above should be replaced by the following:

#ifdef __CYGWIN__
    extern __declspec(dllimport) struct sqlca sqlca;
#else
    extern struct sqlca sqlca;

or by

#ifdef __CYGWIN__
    extern DLLIMPORT struct sqlca sqlca;
#else
    extern struct sqlca sqlca;

if c.h can be safely included.

> I recompiled postgres and skipped stripping of the libraries.  Then I find
> sqlca in ecpg.dll:
> 
> michael> nm /usr/bin/ecpg.dll | grep sqlca
> c0586864 T _init_sqlca
> c0587000 D _sqlca
> c05870b0 d _sqlca_init

Don't worry sqlca *is* exported from ecpg.dll:

    $ objdump -p /usr/bin/ecpg.dll | fgrep sqlca
            [  28] init_sqlca
            [  29] sqlca

> but not in libecpg.a:
> 
> michael> nm /usr/lib/libecpg.a | grep sqlca
> 00000000 I __imp__sqlca
> 00000000 I __imp__init_sqlca
> 00000000 T _init_sqlca

Actually, sqlca *is* in the import library but it is called
"__imp__sqlca" as it should be.

Does changing your sqlca.h as above fix your problem.  If so, then I
will submit a patch to the pgsql-ports mailing list.

Are there other ESQL related symbols that need the __declspec(dllimport)
attribute too?

Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason DOT Tishler AT dothill DOT com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019