[英]Creating an extension for postgreSQL
We are creating a simple extension for postgres via Visual Studio, which crashes at building with error: "unresolved external symbol _pg_detoast_datum referenced in function _foo" 我们正在通过Visual Studio为postgres创建一个简单的扩展程序,该扩展程序在构建时因错误而崩溃: “函数_foo中引用的未解析的外部符号_pg_detoast_datum”
#include "postgres.h"
#include<sys/types.h>
#include<sys/stat.h>
#include "fmgr.h"
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
/* Add a prototype marked PGDLLEXPORT */
PGDLLEXPORT Datum foo(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(foo);
Datum
foo(PG_FUNCTION_ARGS)
{
text *arg = PG_GETARG_TEXT_P(0); // <-- error appears to be here
PG_RETURN_INT32(1);
}
If we change text *arg = PG_GETARG_TEXT_P(0) to int32 arg = PG_GETARG_INT32(0) it works fine; 如果将文本* arg = PG_GETARG_TEXT_P(0)更改为int32 arg = PG_GETARG_INT32(0),它将正常工作;
The problem was that VS requires x86 PostgreSQL version (not x64) to build the project. 问题是VS需要x86 PostgreSQL版本(而不是x64)来构建项目。
PS> For the future readers. PS>对于未来的读者。 Pavel Stehule's provided a link to a realy usefull tutorial for building PostgreSQL extensions in VS - http://blog.2ndquadrant.com/compiling-postgresql-extensions-visual-studio-windows/
帕维尔Stehule对在VS建立PostgreSQL扩展提供了一个链接到一个真的有用的教程- http://blog.2ndquadrant.com/compiling-postgresql-extensions-visual-studio-windows/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.