From: | "Kevin Flanagan" <kevin-f(at)linkprior(dot)com> |
---|---|
To: | "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "'PostgreSQL-development'" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Access violation from palloc, Visual Studio 2005, C-language function |
Date: | 2010-03-10 09:28:40 |
Message-ID: | 00a901cac034$129dbc00$37d93400$@com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Well -
>>
Hard to tell without seeing the actual code and a stack trace, but I'd
bet that you haven't fully resolved the build process problems you
mentioned earlier.
<<
I've attached a zip of the (tiny) project, and a text file with the contents
of the module containing the C-language functions. The only difference from
sample code is that (as pointed out by Takahiro Itagaki in his post here of
8th March) the function implementations need decorating with
__declspec(dllexport). (I hope the attachments don't break mailing list
policy.)
>>
I'm thinking this may be a symptom of linkage failure, since palloc is
probably the first place in the above-described sequence where your DLL is
going to call back into the core backend.
<<
Hmm. But isn't palloc found in postgres.lib, which my DLL statically links
to? Or is that not the lib I'm supposed to link to? (found in c c:\Program
Files\PostgreSQL\8.4\lib) If I don't include it as an input to the linker, I
get "unresolved external symbol _MemoryContextAlloc referenced in function
_copytext" and other unresolved externals ...
>>
Another possibility is that you mistranscribed the example somehow.
Maybe you forgot the PG_FUNCTION_INFO_V1(copytext) macro?
<<
No, that's there.
>>
> Failing that, are there any other (creative?) ways to return strings from
a
> C-language function without using palloc?
If you can't make those examples work, you have fundamental problems you
need to fix, not find a "creative workaround".
<<
I certainly agree in principle, but when you have a deadline to meet,
sometimes you can be under great pressure to find a temporary workaround ...
with the emphasis on temporary.
Thanks in advance for any further leads
Kevin
Attachment | Content-Type | Size |
---|---|---|
palloc_test.zip | application/x-zip-compressed | 7.9 KB |
PgFns.txt | text/plain | 869 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Flanagan | 2010-03-10 10:03:58 | Re: Access violation from palloc, Visual Studio 2005, C-language function |
Previous Message | Fujii Masao | 2010-03-10 09:09:57 | walreceiver is uninterruptible on win32 |