C User Defined Functions

Поиск
Список
Период
Сортировка
От Jake Silverman
Тема C User Defined Functions
Дата
Msg-id CALZGOS5fRAQjE42uEuXhOzVxo8Vw3LSHV9vU_kFtD0_8ZF-Nfw@mail.gmail.com
обсуждение исходный текст
Список 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'


I noticed my problem was very similar to the following one:

Therefore, I followed the advice in the response (http://www.postgresql.org/message-id/1281540487156-2472055.post@n5.nabble.com) and commented out both the timezone and itimerval structs in pg_config_os.h

The compilation then worked fine. I then tried to add my functions into my database using the command given in chapter 35.9 

"CREATE FUNCTION add_one(integer) RETURNS integer     AS 'DIRECTORY/funcs', 'add_one'     LANGUAGE C STRICT;"

Upon doing this I received the error "could not load library "C:/testFuncss.dll": The specified procedure could not be found.

After searching Google for things that might evoke that error, I found out that the problem need not lie in the dll file itself but may lie in something the dll file is calling. I am wondering if the procedure lost relates to the structs commented out. If so, how can I compile the c file without commenting out the structs?

If not, what should my next step be in trying to add these functions?

Thanks,
Jake

В списке pgsql-general по дате отправления:

Предыдущее
От: Paul Tilles
Дата:
Сообщение: V8.4 TOAST table problem
Следующее
От: boraldomaster
Дата:
Сообщение: How to create a cursor that is independent of transactions and doesn't calculated when created ?