From: | Tomáš Kovářík <kovarik(dot)tomas(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Server crash during simple c-language function |
Date: | 2010-09-16 17:11:25 |
Message-ID: | AANLkTi=QBQ6E6DLQ1XN49tswWaemjfKzsAr2Ayss_jzZ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Thanks Robert for the test on MacOS X. I wanted to be sure that it is
not only my installation issue, so I tried the same on Windows Server
2003 with PostgreSQL 8.3; the same crash. Is there anybody who has
written a C-function on Windows platform?
Tomas
2010/9/15 Robert Haas <robertmhaas(at)gmail(dot)com>:
> 2010/9/15 Tomáš Kovářík <kovarik(dot)tomas(at)gmail(dot)com>:
>> I am trying to create a simple c-language function for "PostgreSQL
>> 8.4.4, compiled by Visual C++ build 1400, 32-bit" running on Windows 7
>> (32-bit). It works, until I use a SPI.
>>
>> 1) CRASH: I successfully execute a simple query using SPI_exec(), but
>> when getting the result, it crashes:
>> SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1);
>> I tried to look wherever I could, but I have no idea what could go wrong.
>>
>> 2) NOT COMPILE: When I want to read value of global SPI_result, I
>> cannot compile - unresolved external symbol "_SPI_result". I am
>> currently linking with 'postgres.lib" and I haven't found anything
>> else what to link with additionally. Compiling using Visual Studio
>> 2008, C/C++ project set to compile for "C".
>>
>> Can anybody point out, what I am doing wrong?
>> The complete code and project are below.
>
> I tried your example on MacOS X and it worked OK, so it's probably
> some bit of Windows-specific weirdness, but unfortunately my
> Windows-fu is pretty poor, so I can't speculate...
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise Postgres Company
>
From | Date | Subject | |
---|---|---|---|
Next Message | Markus Wanner | 2010-09-16 17:20:51 | Re: bg worker: patch 1 of 6 - permanent process |
Previous Message | Magnus Hagander | 2010-09-16 17:05:30 | Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session |