Re: Access violation from palloc, Visual Studio 2005, C-language function
От | Kevin Flanagan |
---|---|
Тема | Re: Access violation from palloc, Visual Studio 2005, C-language function |
Дата | |
Msg-id | 00bd01cac039$0139e240$03ada6c0$@com обсуждение исходный текст |
Ответ на | Re: Access violation from palloc, Visual Studio 2005, C-language function ("Kevin Flanagan" <kevin-f@linkprior.com>) |
Список | pgsql-hackers |
Forgot to include the call stack info, such as it is - screen shot attached. Kevin. -----Original Message----- From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Kevin Flanagan Sent: 10 March 2010 09:29 To: 'Tom Lane' Cc: 'PostgreSQL-development' Subject: Re: [HACKERS] Access violation from palloc, Visual Studio 2005, C-language function 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
В списке pgsql-hackers по дате отправления: