pgsql: PGDLLEXPORT is __declspec (dllexport) only on MSVC, but is

Lists: pgsql-committerspgsql-hackers
From: itagaki(at)postgresql(dot)org (Takahiro Itagaki)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: PGDLLEXPORT is __declspec (dllexport) only on MSVC, but is
Date: 2010-05-28 16:34:16
Message-ID: 20100528163416.0F4AF7541D2@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
PGDLLEXPORT is __declspec (dllexport) only on MSVC,
but is __declspec (dllimport) on other compilers
because cygwin and mingw don't like dllexport.

Modified Files:
--------------
pgsql/src/include/port:
cygwin.h (r1.8 -> r1.9)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/port/cygwin.h?r1=1.8&r2=1.9)
win32.h (r1.94 -> r1.95)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/port/win32.h?r1=1.94&r2=1.95)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: PGDLLEXPORT is __declspec (dllexport) only on MSVC, but is
Date: 2010-05-28 19:21:31
Message-ID: 4823.1275074491@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

itagaki(at)postgresql(dot)org (Takahiro Itagaki) writes:
> Log Message:
> -----------
> PGDLLEXPORT is __declspec (dllexport) only on MSVC,
> but is __declspec (dllimport) on other compilers
> because cygwin and mingw don't like dllexport.

That probably explains why the code was the way it was before ...

regards, tom lane


From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: PGDLLEXPORT is __declspec (dllexport) only on MSVC, but is
Date: 2010-06-01 21:52:57
Message-ID: 4C058139.8020801@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

井上です。
ご苦労様です。

このスレッド気になっていたのですが、ようやく少し
余裕ができたのでテストなどしてみました。

Takahiro Itagaki wrote:
> Log Message:
> -----------
> PGDLLEXPORT is __declspec (dllexport) only on MSVC,
> but is __declspec (dllimport) on other compilers

私が知る限りdlimportがexportの引きがねになることは
ないのでこの部分にはかなり違和感を感じていました。
実際__declspec(..)をすっぱり取り除いてmingwでbuild
してみましたが少なくともinitdbでエラーになることは
ありません。この場合の__declspec(dllimport)指定は
意味があるようには思えませんし運よく害がないだけだ
という気がします。

> because cygwin and mingw don't like dllexport.

一方__declspec(dllexport)指定は運悪く害があるのです
が原因は単純ではなさそうです。エラーが発生している
場所はLoadLibrary()でありGetProcAddress()ではない
ので関数がexportされないという原因ではなさそうです。
ネットを見て回ったところではdllwrap(及び?dlltool)
を使っているのがまずいのかなという感触はありますが
明確な所はわかりません。又、それを避けるにはどうし
たらよいのかがわかるほどmingwに詳しくはありません。

以上 参考まで

> Modified Files:
> --------------
> pgsql/src/include/port:
> cygwin.h (r1.8 -> r1.9)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/port/cygwin.h?r1=1.8&r2=1.9)
> win32.h (r1.94 -> r1.95)
> (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/port/win32.h?r1=1.94&r2=1.95)