Thread: Writing C functions

Writing C functions

From
Jeff Davis
Date:
This is a very quick question regarding C functions:

After you have written a functions.c file, how do you
compile it how postgres wants it with gcc?
The tutorial just said that here is an example, you
compile it as a .so file, then import it with these
sql commands. It didn't say how to make it a .so file
(it assumed we would know I guess).

Thanks (and please excuse my ignorance),
Jeff Davis
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Re: [GENERAL] Writing C functions

From
Alexey Vyskubov
Date:
> After you have written a functions.c file, how do you
> compile it how postgres wants it with gcc?

Well. It depends on your OS.
Under OpenBSD works

gcc -fpic -c -o file.o file.c
ld -Bshareable -o file.so file.c

info gcc should help you.

--
Alexey