On 12/01/12 11:06, Edwin Quijada wrote:
Hi!
I am trying to create a C function for windows in Postgres compiling with VC++ 2008 Express Edition. I did this function for Linux without problem using gcc and tried to do the same in Windows but in Windows was imposible. The function compile fine but when I tried to run from Postgres it down the server in windows but in Linux the same function run perfect.
You haven't provided enough information for anyone to help you.
How are you compiling your function? Using pgxs, or some other way?
What's the full source code of the function?
Where does the server crash when it crashes? You might need to get a backtrace of the server crash to help you figure out why your function crashes it. See this documentation on getting a backtrace of a Pg backend under windows:
http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Windows
The function just try to get a string value and pass to postgres. Reading somebody told me that I need to compile the function using VC++ not gcc in Windows so I downloaded VC++ 2008 Express but I dont know what directives compilation I need as gcc in windows and Linux.
If you are using a standard binary distribution of PostgreSQL then yes, you should use Visual C++, preferably the same version of Visual C++ that was used for that version of PostgreSQL. Specify your version of Pg.
--
Craig Ringer