Adminpack build fix

Started by Magnus Haganderabout 19 years ago8 messages
#1Magnus Hagander
mha@sollentuna.net
1 attachment(s)

Attached patch removes a couple of extern definitions from adminpack,
replacing some of them with a #include. (Cam eup with this because we
got a duplicate definition of DataDir when building with Visual C++).
Seems much more correct to pull in the header file that has the
definition, and only do that.

//Magnus

Attachments:

adminpack.diffapplication/octet-stream; name=adminpack.diffDownload
Index: contrib\adminpack/adminpack.c
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/contrib/adminpack/adminpack.c,v
retrieving revision 1.4
diff -c -r1.4 adminpack.c
*** contrib\adminpack/adminpack.c	4 Oct 2006 00:29:44 -0000	1.4
--- contrib\adminpack/adminpack.c	19 Oct 2006 17:24:31 -0000
***************
*** 24,29 ****
--- 24,30 ----
  #include "funcapi.h"
  #include "storage/fd.h"
  #include "utils/datetime.h"
+ #include "postmaster/syslogger.h"
  
  
  #ifdef WIN32
***************
*** 36,45 ****
  #undef unlink
  #endif
  #endif
- 
- extern DLLIMPORT char *DataDir;
- extern DLLIMPORT char *Log_directory;
- extern DLLIMPORT char *Log_filename;
  
  PG_MODULE_MAGIC;
  
--- 37,42 ----
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: Adminpack build fix

"Magnus Hagander" <mha@sollentuna.net> writes:

Attached patch removes a couple of extern definitions from adminpack,
replacing some of them with a #include. (Cam eup with this because we
got a duplicate definition of DataDir when building with Visual C++).

That isn't going to work unless we put DLLIMPORT into the main headers.
The reason for redeclaring these in the contrib files is to get
DLLIMPORT onto them...

regards, tom lane

#3Magnus Hagander
mha@sollentuna.net
In reply to: Tom Lane (#2)
Re: Adminpack build fix

Attached patch removes a couple of extern definitions from

adminpack,

replacing some of them with a #include. (Cam eup with this

because we

got a duplicate definition of DataDir when building with

Visual C++).

That isn't going to work unless we put DLLIMPORT into the
main headers.
The reason for redeclaring these in the contrib files is to
get DLLIMPORT onto them...

Interedting - it builds on MSVC without it :-O

Anyway. That certainly explains why MSVC is complaining - it's getting
completely different definitions of these variables from the header and
from the actual file.

What do you think about simply adding DLLIMPORT to the variables in the
main header?

//Magnus

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#3)
Re: Adminpack build fix

"Magnus Hagander" <mha@sollentuna.net> writes:

The reason for redeclaring these in the contrib files is to
get DLLIMPORT onto them...

Interedting - it builds on MSVC without it :-O

Anyway. That certainly explains why MSVC is complaining - it's getting
completely different definitions of these variables from the header and
from the actual file.

The same redeclaration technique is being used elsewhere (pg_buffercache
and pg_freespacemap it looks like). Aren't you getting warnings there
too?

regards, tom lane

#5Magnus Hagander
mha@sollentuna.net
In reply to: Tom Lane (#4)
Re: Adminpack build fix

The reason for redeclaring these in the contrib files is to get
DLLIMPORT onto them...

Interedting - it builds on MSVC without it :-O

Anyway. That certainly explains why MSVC is complaining -

it's getting

completely different definitions of these variables from the header
and from the actual file.

The same redeclaration technique is being used elsewhere
(pg_buffercache and pg_freespacemap it looks like). Aren't
you getting warnings there too?

I am - I just started working on getting those done as well. (they were
also living on my list of fix-later ones for some other reasons - the
other reasons now having been fixed)

//Magnus

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#5)
Re: Adminpack build fix

"Magnus Hagander" <mha@sollentuna.net> writes:

The same redeclaration technique is being used elsewhere
(pg_buffercache and pg_freespacemap it looks like). Aren't
you getting warnings there too?

I am - I just started working on getting those done as well.

OK, I guess we gotta play them all honestly. Will fix.

regards, tom lane

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: Adminpack build fix

"Magnus Hagander" <mha@sollentuna.net> writes:

Attached patch removes a couple of extern definitions from adminpack,
replacing some of them with a #include.

I've now removed all the local DLLIMPORT-redeclarations I could find
in favor of marking the relevant variables in the main header files.

regards, tom lane

#8Magnus Hagander
mha@sollentuna.net
In reply to: Tom Lane (#7)
Re: Adminpack build fix

Attached patch removes a couple of extern definitions from

adminpack,

replacing some of them with a #include.

I've now removed all the local DLLIMPORT-redeclarations I
could find in favor of marking the relevant variables in the
main header files.

Thanks. All affected projects build with MSVC now - haven't tested if
they work, but they pass the compiler...

//Magnus