Re: DLL export with mingw-w64: currently a no-op - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: DLL export with mingw-w64: currently a no-op
Date
Msg-id 4DBFF7BC.9060100@dunslane.net
Whole thread Raw
In response to Re: DLL export with mingw-w64: currently a no-op  ("Johann 'Myrkraverk' Oskarsson" <johann@2ndquadrant.com>)
Responses Re: DLL export with mingw-w64: currently a no-op  ("Johann 'Myrkraverk' Oskarsson" <johann@2ndquadrant.com>)
List pgsql-hackers

On 05/03/2011 06:45 AM, Johann 'Myrkraverk' Oskarsson wrote:
> On Tue, 03 May 2011 09:32:29 -0000, Andrew Dunstan 
> <andrew@dunslane.net> wrote:
>
>> On 05/03/2011 02:46 AM, Johann 'Myrkraverk' Oskarsson wrote:
>>>
>>> When compiling PG with mingw-w64 the PGDLLEXPORT macro is blank.
>>>
>>> Here is a patch that "fixes it for me."  If this is correct, I'd
>>> appreciate it will be applied to 9.0.x as well as HEAD.
>>
>> AFAICT it's not broken and doesn't need fixing. We don't define this 
>> for the 32 bit MinGW compiler, so why should it be necessary in the 
>> 64 bit case?
>
> I am using a different build procedure for 64bit than 32bit, as adviced
> by the mingw-w64 team.  The final step I use is:
>   ${CC} -shared -o ${plugin} ${OBJS} ${BE_DLLLIBS} -L. -ljvm
>
> I guess that is my "issue."  Without __declspec(dllexport) in the magic
> macro Pg_magic_func() isn't exported properly because of that, for ex-
> ample.
>
> Now while I can only blame myself for using something different/un-
> supported, I have to ask, why was I told to use gcc in the final
> link step by the mingw-w64 team while you (postgres) use something
> else (I presume dlltool)?

Our Makefiles use dlltool and dllwrap to create DLLs. If you used our 
recommended build method pgxs would do lots of the work for you.

I'm not sure why you asked the mingw-w64 team about building a Postgres 
extension - they are unlikely to know anything much about our build system.

cheers

andrew


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: FDW table hints
Next
From: Tom Lane
Date:
Subject: Re: FDW table hints