Thread: Problems adding C Extentions

Problems adding C Extentions

From
DDonnelly@rochgrp.com
Date:
I am moving a Postgres application from Linux to Cygwin.  The application
has some Postgres extensions built in C.  I get a clean compile and load,
but when I go to load the functions into Postgres I get a load error.  I
would appreciate any guidance.  Here is the code and error message:

create function RealPct(int4, int4) returns float8
        as '/home/ddonn/stc/model/stcdemo/STCModel.so' language 'c'
with(isStrict);
ERROR:  Load of file /home/ddonn/stc/model/stcdemo/STCModel.so failed:
dlopen: Win32 error 3221225622

Dan Donnelly

Re: Problems adding C Extentions

From
"Norman Vine"
Date:
DDonnelly@rochgrp.com writes:

> I am moving a Postgres application from Linux to Cygwin.  The application
> has some Postgres extensions built in C.  I get a clean compile and load,
> but when I go to load the functions into Postgres I get a load error.  I
> would appreciate any guidance.  Here is the code and error message:
>
> create function RealPct(int4, int4) returns float8
>         as '/home/ddonn/stc/model/stcdemo/STCModel.so' language 'c'
> with(isStrict);
> ERROR:  Load of file /home/ddonn/stc/model/stcdemo/STCModel.so failed:
> dlopen: Win32 error 3221225622

Make sure you have the following in your Makefile

override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)


HTH

Norman

Re: Problems adding C Extentions

From
Oliver Vecernik
Date:
DDonnelly@rochgrp.com schrieb:

>I am moving a Postgres application from Linux to Cygwin.  The application
>has some Postgres extensions built in C.  I get a clean compile and load,
>but when I go to load the functions into Postgres I get a load error.  I
>would appreciate any guidance.  Here is the code and error message:
>
>create function RealPct(int4, int4) returns float8
>        as '/home/ddonn/stc/model/stcdemo/STCModel.so' language 'c'
>with(isStrict);
>ERROR:  Load of file /home/ddonn/stc/model/stcdemo/STCModel.so failed:
>dlopen: Win32 error 3221225622
>
Doesn't windows need *.dll files instead of *.so?

Oliver

--
VECERNIK Datenerfassungssysteme
A-2560 Hernstein, Hofkogelgasse 17
Tel.: +43 2633 47530, Fax: DW 50
http://members.aon.at/vecernik




Re: Problems adding C Extentions

From
DDonnelly@rochgrp.com
Date:
I'm not sure where to add that directive.  We use the standard configure and
make to build postgres for the cygwin environment and that seems to work
fine.  For our C code we have one c module and on linux build it with the
following command :

PGINCLUDEPATH="-I `pg_config --includedir` -I
/usr/src/postgresql-7.3-1/src/include"
PGLIBPATH="-L `pg_config --libdir` -L /usr/src/postgresql-7.3-1/src/backend"

LIBNAME=`echo $1 | sed 's/\.c/.so/'`
OBJNAME=`echo $1 | sed 's/\.c/\.o/'`

LIBS="-lpostgres -lc"

echo 'This is pgcc...'

echo "gcc $PGINCLUDE -c $1"
gcc $PGINCLUDEPATH -c $1

ld -shared -o $LIBNAME $OBJNAME $PGLIBPATH $LIBS

Any more help you could provide me would be greatly appreciated.


-----Original Message-----
From: Norman Vine [mailto:nhv@cape.com]
Sent: Wednesday, January 29, 2003 12:33 AM
To: Donnelly, Dan; pgsql-cygwin@postgresql.org
Subject: Re: [CYGWIN] Problems adding C Extentions


DDonnelly@rochgrp.com writes:

> I am moving a Postgres application from Linux to Cygwin.  The application
> has some Postgres extensions built in C.  I get a clean compile and load,
> but when I go to load the functions into Postgres I get a load error.  I
> would appreciate any guidance.  Here is the code and error message:
>
> create function RealPct(int4, int4) returns float8
>         as '/home/ddonn/stc/model/stcdemo/STCModel.so' language 'c'
> with(isStrict);
> ERROR:  Load of file /home/ddonn/stc/model/stcdemo/STCModel.so failed:
> dlopen: Win32 error 3221225622

Make sure you have the following in your Makefile

override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)


HTH

Norman