Re: C User Defined Functions

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Cc: Jake Silverman <jakerosssilv(at)gmail(dot)com>
Subject: Re: C User Defined Functions
Date: 2014-01-11 09:37:12
Message-ID: 52D110C8.2070500@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Hey,
>
> I was trying to compile a user-defined function in C (I am trying to
> compile one of the examples given in chapter 35.9 of the 9.3beta2
> documentation) using Microsoft Visual Studio Express 2012 on a 64-bit
> Windows 7 computer.
>
> I ran into the following error:
>
> C:\>cl /I "C:\postgres9.3beta2FI\include\server" /I
> "C:\postgres9.3beta2FI\include\server" /c "testFuncss.c"
> Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50727.1 for x64
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> testFuncss.c
> c:\postgres9.3beta2fi\include\server\pg_config_os.h(207) : error C2011:
> 'timezone' : 'struct' type redefinition
> c:\postgres9.3beta2fi\include\server\pg_config_os.h(207) : see
> declaration of 'timezone'
> c:\postgres9.3beta2fi\include\server\pg_config_os.h(216) : error C2011:
> 'itimerval' : 'struct' type redefinition
> c:\postgres9.3beta2fi\include\server\pg_config_os.h(216) : see
> declaration of 'itimerval'

This turns out to be a header bug of sorts. To work around it define
WIN32 in your project file.

I've added information about this, and the next error you mention, to
the wiki:
https://wiki.postgresql.org/wiki/Building_and_Installing_PostgreSQL_Extension_Modules

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Browse pgsql-general by date

  From Date Subject
Next Message Seref Arikan 2014-01-11 12:06:40 Do you have any best practices for managing large file's metadata with postgres?
Previous Message Bruce Momjian 2014-01-11 02:59:36 Re: pg_upgrade & tablespaces