亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 3966 | 回復(fù): 1
打印 上一主題 下一主題

postgresql下C語言擴(kuò)展函數(shù)出現(xiàn)錯(cuò)誤 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2007-02-24 22:55 |只看該作者 |倒序?yàn)g覽
編譯官方文檔31.7.3例子:
源代碼如下:
#include "postgres.h"
#include <string.h>

/* 傳遞數(shù)值 */

int
add_one(int arg)
{
    return arg + 1;
}
其余的去掉了。存儲(chǔ)文funs.c文件,編譯為funs.so文件

使用如下語句定義PostgreSQL 函數(shù)時(shí)出錯(cuò):

CREATE FUNCTION add_one(integer) RETURNS integer
     AS '/usr/local/pgsql/lib/funs.so', 'add_one'
     LANGUAGE C STRICT;

錯(cuò)誤:
ERROR:  incompatible library "/usr/local/pgsql/lib/func.so": missing magic block
HINT:  Extension libraries are required to use the PG_MODULE_MAGIC macro.

postgresql 8.2.3
red hat tenterprise linux 4

官方8.2.3文檔提示如下:
To ensure that a dynamically loaded object file is not loaded into an incompatible server, PostgreSQL
checks that the file contains a “magic block” with the appropriate contents. This allows the server to
detect obvious incompatibilities, such as code compiled for a different major version of PostgreSQL. A
magic block is required as of PostgreSQL 8.2. To include a magic block, write this in one (and only one)
of the module source files, after having included the header fmgr.h:
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
The #ifdef test can be omitted if the code doesn’t need to compile against pre-8.2 PostgreSQL releases.
After it is used for the first time, a dynamically loaded object file is retained in memory. Future calls in the
same session to the function(s) in that file will only incur the small overhead of a symbol table lookup. If
you need to force a reload of an object file, for example after recompiling it, use the LOAD command or
begin a fresh session.
Optionally, a dynamically loaded file can contain initialization and finalization functions. If the file includes
a function named _PG_init, that function will be called immediately after loading the file. The
function receives no parameters and should return void. If the file includes a function named _PG_fini,
that function will be called immediately before unloading the file. Likewise, the function receives no parameters
and should return void. Note that _PG_fini will only be called during an unload of the file, not
during process termination. (Presently, an unload only happens in the context of re-loading the file due to
an explicit LOAD command.)

該怎么處理,請(qǐng)高手幫忙。

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2007-03-22 22:34 |只看該作者

回復(fù) 1樓 m_lm 的帖子

fmgr.h加入如下語句
#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif
從新編譯安裝,ok。問題解決了
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP