C Functions

Lists: pgsql-cygwin
From: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
To: pgsql-cygwin(at)postgresql(dot)org
Subject: C Functions
Date: 2003-11-11 20:42:09
Message-ID: 1068583329.1071.36.camel@taz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

Hi everyone. I have a problem and I don't have a clue of how to solve
it... some time ago I had programmed a couple of C functions for
postgresql on my freebsd system, and compiled them into a .so file. It
worked great.

Now I have to make a demo, and I've been given a WinXP notebook. I
decided to go for postgresql on cygwin, and it works just fine as a
service.
The thing is that now I want to recompile my C source code (gcc works
fine) and generate the library (gcc -shared), and I get a lot of
undefined references (_textin, _DirectFunctionCall1,
_MemoryContextAlloc, etc.).

Could anyone tell me what to do, cause I'm really lost here.
Thanks in advance.


From: Jason Tishler <jason(at)tishler(dot)net>
To: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: C Functions
Date: 2003-11-13 18:29:19
Message-ID: 20031113182919.GC1168@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

On Tue, Nov 11, 2003 at 05:42:09PM -0300, Franco Bruno Borghesi wrote:
> Could anyone tell me what to do, cause I'm really lost here.

<WAG>
The following thread may apply:

http://archives.postgresql.org/pgsql-cygwin/2003-11/msg00010.php
</WAG>

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6


From: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
To: Jason Tishler <jason(at)tishler(dot)net>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: C Functions
Date: 2003-11-13 18:42:37
Message-ID: 1068748956.1642.6.camel@taz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

Thanks Jason!
I have to tell you that I had managed to solve this before your reply,
but I think it would be good to explain what I did for any other person
who has the same problem.

My library is called pgakya, so anyone interested should relpace pgakya
for the name of the library he intends to build.

I replaced in my Makefile :
gcc -shared -o ..\bin\pgakya.so *.o
for:
dlltool --export-all --output-def pgakya.def *.o
dllwrap -o ..\bin\pgakya.dll --dllname pgakya.dll -def pgakya.def
*.o /tmp/postgresql7.4RC2/src/utils/dllinit.o /usr/lib/postgresql
-Ltmp/postgresql7.4RC2/src/backend -lpostgres

this two lines did the job, and everything works perfect now.

Thanks again Jason.

On Thu, 2003-11-13 at 15:29, Jason Tishler wrote:

> On Tue, Nov 11, 2003 at 05:42:09PM -0300, Franco Bruno Borghesi wrote:
> > Could anyone tell me what to do, cause I'm really lost here.
>
> <WAG>
> The following thread may apply:
>
> http://archives.postgresql.org/pgsql-cygwin/2003-11/msg00010.php
> </WAG>
>
> Jason


From: Jason Tishler <jason(at)tishler(dot)net>
To: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: C Functions
Date: 2003-11-13 19:25:07
Message-ID: 20031113192506.GD1168@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin

On Thu, Nov 13, 2003 at 03:42:37PM -0300, Franco Bruno Borghesi wrote:
> Thanks Jason!

You are welcome.

> I replaced in my Makefile :
> gcc -shared -o ..\bin\pgakya.so *.o
> for:
> dlltool --export-all --output-def pgakya.def *.o
> dllwrap -o ..\bin\pgakya.dll --dllname pgakya.dll -def pgakya.def
> *.o /tmp/ postgresql7.4RC2/src/utils/dllinit.o /usr/lib/postgresql
> -Ltmp/postgresql7.4RC2 /src/backend -lpostgres
>
> this two lines did the job, and everything works perfect now.

The following should work too:

gcc -shared -Wl,--export-all-symbols -o ../bin/pgakya.dll *.o -L/tmp/postgresql7.4RC2/src/backend -lpostgres

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6