Did you use the compiler option for generating
position independent code (PIC) for use in building
shared libraries.
Did you use the linker option for creating
a shared library - I think you did, the file
suffix .so looks that way.
I did it several times successfully using commands
like
CREATE FUNCTION byteatostr(bytea) RETURNS textAS './byteatostr.sl' LANGUAGE 'c';
and it worked.
Maybe you should add some more information about
what you did in detail.
Regards, Christoph