I'm working with PostgreSQL under Windows operationg system, and now I need to write some external C-language functionf for PostgreSQL. As I read in documentation it is possible to compile .so shared library with function and export it from .so. But as I also read it is possible only in linux/unix system using gcc, not in windows.
Is it possible to export C-language function to PostgreSQL in Windows? Would be nice if it also possible using Visual Studio
I'm sorry if such questions were already asked, but I didn't find them.
I'm having the same problem in creating an external C function compiled with Visual Studio C++.
I'm using PostgreSQL 8.3.3, and when i compile in the IDE it makes the dll, but i receive missing PG_MODULE_MAGIC error.
If I try to compile in command-line with
CL -Ipath_to_pg_serve_include myfunc.cpp
it says missing "libintl.h", as well as some type redefinition errors:
C:\Documents and Settings\pduque.WOLVERINE\My Documents\MyFuncpg>cl /I"C:\Program Files\PostgreSQL\8.3\include\server" myfunc.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
c:\program files\postgresql\8.3\include\server\pg_config_os.h (188) : error C2011
: 'timezone' : 'struct' type redefinition
c:\program files\postgresql\8.3\include\server\pg_config_os.h (188) : see
declaration of 'timezone'
c:\program files\postgresql\8.3\include\server\pg_config_os.h (197) : error C2011
: 'itimerval' : 'struct' type redefinition
c:\program files\postgresql\8.3\include\server\pg_config_os.h (197) : see
declaration of 'itimerval'
c:\program files\postgresql\8.3\include\server\c.h(97) : fatal error C1083: Cann
ot open include file: 'libintl.h': No such file or directory