Re: cygwin build failure - Mailing list pgsql-hackers

From Maarten Boekhold
Subject Re: cygwin build failure
Date
Msg-id 418F86A6.1000805@emirates.net.ae
Whole thread Raw
In response to Re: cygwin build failure  (Reini Urban <rurban@x-ray.at>)
List pgsql-hackers
Hi,

Related to the definition of __DLL_IMPORT below, the cygwin port of 
glib/gmodule just does the following:

#define    G_MODULE_IMPORT        extern
#ifdef G_PLATFORM_WIN32
#  define    G_MODULE_EXPORT        __declspec(dllexport)
#else /* !G_PLATFORM_WIN32 */
#  define    G_MODULE_EXPORT
#endif /* !G_PLATFORM_WIN32 */

Also, it doesn't make any distinction whether you are building a DLL or not.

The following example has been tested and it works (I've done the 
example without gmodule, as we wouldn't want to use that within 
postgresql anyways):

dll.h:
extern void foo();

dll.c:
#include "dll.h"

__declspec(dllexport) void foo() {return;
}

main.c:
#include "dll.h"

int main(int argc, char **argv) {foo();return 0;
}

This is with recent GCC (3.3.3 on my system), but it probably also works  with older GCC versions.

Don't know if this information is useful in simplying things...

Maarten

Reini Urban wrote:
> #ifdef BUILDING_DLL
> # ifndef __GNUC__
> #  define __DLL_IMPORT __declspec(dllimport)
> # else
> #  define __DLL_IMPORT __attribute__((dllimport)) extern
> # endif
> #else
> # define __DLL_IMPORT
> #endif


pgsql-hackers by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: Increasing the length of pg_stat_activity.current_query...
Next
From: "Marc G. Fournier"
Date:
Subject: Re: [COMMITTERS] pgsql: Remove: * Allow database recovery where