Re: Building Windows Server Extensions Using VC++ 2005

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Building Windows Server Extensions Using VC++ 2005
Дата
Msg-id 200603050445.k254j7S23291@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Building Windows Server Extensions Using VC++ 2005  (Charlie Savage <cfis@interserv.com>)
Список pgsql-hackers
Charlie Savage wrote:
> Hi everyone,
>
> Thanks for the feedback.  The reason for building extensions with MSVC
> on windows is to get access to the Micrsoft debugging tools since as far
> as I can see MingW/GDB cannot debug dynamically loaded dlls on the
> Windows platform (or at least I haven't succeeded at doing it).
>
> Anyway, with the few minor tweaks mentioned this seems to work fine.  I
> guess I would be surprised if it didn't since MinGW is commonly used for
> both creating and using DLLs on the Windows platform that integrate with
> programs and dlls built with VC++.  Other examples that work fine are
> building extensions for Python and Ruby using MingW, when both runtimes
> are built with VC++ (so the opposite case).  Of course, this
> compatibility might just be limited to the MinGW / VC++ combination, but
> that's all you need for this to work.

OK, I improved the STRINGS_H macro check and added DLLIMPORT in case
Win32 users don't export everything.  Added comments.  This is all 8.2
stuff.

--
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, Inc.   http://www.sraoss.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/include/c.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/c.h,v
retrieving revision 1.197
diff -c -c -r1.197 c.h
*** src/include/c.h    3 Mar 2006 21:35:46 -0000    1.197
--- src/include/c.h    5 Mar 2006 04:39:27 -0000
***************
*** 57,62 ****
--- 57,64 ----
  #else
  #if defined(_MSC_VER) || defined(__BORLANDC__)
  #define WIN32_CLIENT_ONLY
+ /* Some use MinGW-generated pg_config.h but MSVC for extensions. */
+ #undef HAVE_STRINGS_H
  #endif
  #endif
  #include "postgres_ext.h"
***************
*** 66,73 ****
  #include <string.h>
  #include <stddef.h>
  #include <stdarg.h>
! /* Some use MinGW-generated pg_config.h but MSVC for extensions. */
! #if defined(HAVE_STRINGS_H) && !defined(WIN32_CLIENT_ONLY)
  #include <strings.h>
  #endif
  #include <sys/types.h>
--- 68,74 ----
  #include <string.h>
  #include <stddef.h>
  #include <stdarg.h>
! #ifdef HAVE_STRINGS_H
  #include <strings.h>
  #endif
  #include <sys/types.h>
Index: src/include/fmgr.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/fmgr.h,v
retrieving revision 1.40
diff -c -c -r1.40 fmgr.h
*** src/include/fmgr.h    15 Oct 2005 02:49:41 -0000    1.40
--- src/include/fmgr.h    5 Mar 2006 04:39:28 -0000
***************
*** 293,302 ****
  /* Expected signature of an info function */
  typedef Pg_finfo_record *(*PGFInfoFunction) (void);

! /* Macro to build an info function associated with the given function name */
!
  #define PG_FUNCTION_INFO_V1(funcname) \
! extern Pg_finfo_record * CppConcat(pg_finfo_,funcname) (void); \
  Pg_finfo_record * \
  CppConcat(pg_finfo_,funcname) (void) \
  { \
--- 293,305 ----
  /* Expected signature of an info function */
  typedef Pg_finfo_record *(*PGFInfoFunction) (void);

! /*
!  *    Macro to build an info function associated with the given function name.
!  *    Win32 loadable functions usually link with 'dlltool --export-all', but it
!  *    doesn't hurt to add DLLIMPORT in case they don't.
!  */
  #define PG_FUNCTION_INFO_V1(funcname) \
! extern DLLIMPORT Pg_finfo_record * CppConcat(pg_finfo_,funcname) (void); \
  Pg_finfo_record * \
  CppConcat(pg_finfo_,funcname) (void) \
  { \

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Sergey E. Koposov"
Дата:
Сообщение: Re: Not so happy with psql's new multiline behavior
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Not so happy with psql's new multiline behavior