Thread: Problem with compiling extensions with Postgres Version 13

Problem with compiling extensions with Postgres Version 13

From
Eric Svenson
Date:

Hello,

I am not really sure if I am in the right mailing list, but I try it here first.

I have written a postgres C extension as DLL which was used with Postgres 9.2 successfully.

Now I am trying to upgrade to Postgres 13 but I ran into a compile problem.

The function

PG_GETARG_BYTEA_P 

causes the compile error

error LNK2019: unresolved external symbol _pg_detoast_datum referenced in function _compressBytea

The Compiler is
Microsoft Visual Studio 2010 
Windows 10

Any idea what to do? Is PG_GETARG_BYTEA_P obsolete?

Best regards,
Eric

Re: Problem with compiling extensions with Postgres Version 13

From
Laurenz Albe
Date:
On Wed, 2020-11-18 at 14:46 +0100, Eric Svenson wrote:
> I am not really sure if I am in the right mailing list, but I try it here first.
> 
> I have written a postgres C extension as DLL which was used with Postgres 9.2 successfully.
> 
> Now I am trying to upgrade to Postgres 13 but I ran into a compile problem.
> 
> The function
> 
> PG_GETARG_BYTEA_P 
> 
> causes the compile error
> 
> error LNK2019: unresolved external symbol _pg_detoast_datum referenced in function _compressBytea
> 
> The Compiler is
> Microsoft Visual Studio 2010 
> Windows 10
> 
> Any idea what to do? Is PG_GETARG_BYTEA_P obsolete?

In PostgreSQL v13, "PG_GETARG_BYTEA_P(n)" is a macro that resolves to
"((bytea *) pg_detoast_datum((struct varlena *) DatumGetPointer(fcinfo->args[n].value)))".

This has not changed since 9.2, as far as I can tell.

The underscore in front of the function name is relevant: perhaps you compile your function
using a different "calling convention" than was used to build PostgreSQL?

Sorry, but I am not a Windows expert.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com