C functions under windows

Started by Islam Hegazyalmost 19 years ago6 messagesgeneral
Jump to latest
#1Islam Hegazy
islheg@gmail.com

Hi all

I have postgresql server installed on a windows machine and I want to retrieve data using C functions. I followed the steps in the documentation but it didn't work for windows. I created a .dll projects for my functions but postgres.h calls .h files that I can't find on the windows machine like <strings.h>. I tested my functions on another server installed on a linix machine and it worked correctly. So the problem appears to be in the include files under windows.

Any idea how to solve this problem...

Regards
Islam Hegazy

#2Magnus Hagander
magnus@hagander.net
In reply to: Islam Hegazy (#1)
Re: C functions under windows

Are you building with the same compiler as the backend was built with? If you're using the binary distribution that means mingw unless you're testing the
pre-beta snapshot Dave uploaded a few days ago.

/Magnus

------- Original message -------
From: Islam Hegazy <islheg@gmail.com>
Sent: 5-2-'07, 19:30

Hi all

I have postgresql server installed on a windows machine and I want to retrieve data using C functions. I followed the steps in the documentation but it

didn't work for windows. I created a .dll projects for my functions but postgres.h calls .h files that I can't find on the windows machine like <strings.h>. I
tested my functions on another server installed on a linix machine and it worked correctly. So the problem appears to be in the include files under windows.

Show quoted text

Any idea how to solve this problem...

Regards
Islam Hegazy

#3Andrei Kovalevski
andyk@commandprompt.com
In reply to: Islam Hegazy (#1)
Re: C functions under windows

Islam Hegazy wrote:

Hi all

I have postgresql server installed on a windows machine and I want to
retrieve data using C functions. I followed the steps in the
documentation but it didn't work for windows. I created a .dll
projects for my functions but postgres.h calls .h files that I can't
find on the windows machine like <strings.h>. I tested my functions
on another server installed on a linix machine and it worked
correctly. So the problem appears to be in the include files under
windows.

Any idea how to solve this problem...

Regards
Islam Hegazy

If you use MSVC - try to setup 'Additional include directories' for your
project. It should point to the PostgreSQL 'include' folder.

#4Martin Gainty
mgainty@hotmail.com
In reply to: Islam Hegazy (#1)
Re: C functions under windows

Andrei-

*If you're developing under nix* then I would use windows cygwin (bash
shell) e.g.
\cygwin\cygwin.bat
cd /
find . -name strings.h
you will see /usr/include
but this version of strings.h only includes string.h
to bring into environment make sure you include the /usr/include in .profile
or .bashrc e.g.
export INCLUDE=/usr/include:$INCLUDE
(then run your compile/link/make utilties)

HTH
Martin--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.

----- Original Message -----

Show quoted text

Islam Hegazy wrote:

Hi all
I have postgresql server installed on a windows machine and I want to
retrieve data using C functions. I followed the steps in the
documentation but it didn't work for windows. I created a .dll projects
for my functions but postgres.h calls .h files that I can't find on the
windows machine like <strings.h>. I tested my functions on another
server installed on a linix machine and it worked correctly. So the
problem appears to be in the include files under windows.
Any idea how to solve this problem...
Regards
Islam Hegazy

If you use MSVC - try to setup 'Additional include directories' for your
project. It should point to the PostgreSQL 'include' folder.

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

#5Islam Hegazy
islheg@gmail.com
In reply to: Islam Hegazy (#1)
Re: C functions under windows

I have added the path to the include directory of postgresql but it hasn't
already some of the files that are in linux include path like <strings.h>.
It doesn't object about postgres.h which it can find now but it objects
about strings.h

I use MSVC6 to make my dll file.

Regards
Islam

----- Original Message -----
From: "Andrei Kovalevski" <andyk@commandprompt.com>
To: <pgsql-general@postgresql.org>; "Islam Hegazy" <islheg@gmail.com>
Sent: Thursday, May 03, 2007 7:32 AM
Subject: Re: [GENERAL] C functions under windows

Show quoted text

Islam Hegazy wrote:

Hi all
I have postgresql server installed on a windows machine and I want to
retrieve data using C functions. I followed the steps in the
documentation but it didn't work for windows. I created a .dll projects
for my functions but postgres.h calls .h files that I can't find on the
windows machine like <strings.h>. I tested my functions on another
server installed on a linix machine and it worked correctly. So the
problem appears to be in the include files under windows.
Any idea how to solve this problem...
Regards
Islam Hegazy

If you use MSVC - try to setup 'Additional include directories' for your
project. It should point to the PostgreSQL 'include' folder.

#6Magnus Hagander
magnus@hagander.net
In reply to: Islam Hegazy (#5)
Re: C functions under windows

Islam Hegazy wrote:

I have added the path to the include directory of postgresql but it
hasn't already some of the files that are in linux include path like
<strings.h>. It doesn't object about postgres.h which it can find now
but it objects about strings.h

I use MSVC6 to make my dll file.

The include files that ship with your version are made for MingW, not MSVC.

You could try grabbing pg_config.h.win32 from src/include (I think it's
available in the source distribution of 8.2, if not, just get one from a
snapshot version). Then take that file and overwrite your copy of
pg_config.h with it.

strings.h is one of the differences between msvc and mingw.

//Magnus