Re: Linux equivalent library for "postgres.lib" from Windows

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'John R Pierce *EXTERN*'" <pierce(at)hogranch(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Linux equivalent library for "postgres.lib" from Windows
Date: 2016-11-08 10:37:03
Message-ID: A737B7A37273E048B164557ADEF4A58B5397A972@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

John R Pierce wrote:
>> I am new to the product and in windows “postgres.lib” provides certain functions which we are
>> using in windows for creating extensions.
>>
>> Now I am porting the project to Linux and there no straight library with this name in Linux
>> binaries packages.
>>
>> Can someone please advise the equivalent library for postgres.lib in Linux?
>
> I am not sure what this postgres.lib is, what are the functions you're using ?

With MSVC, you have to link with the mylibrary.lib file if you want to use
functions from the shared library mylibrary.dll.
This is not necessary on Linux, where references to a shared library are resolved
at load time.

So the answer to the original question is that there is no replacement
for postgres.lib on Linux because you don't need it to link with PostgreSQL.
It is enough to #include the required PostgreSQL headers during compilation.

Some information on how to link on Linux can be found here:
https://www.postgresql.org/docs/current/static/xfunc-c.html#DFUNC
But as others have remarked, using PGXS is much better than doing
it by hand.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2016-11-08 10:42:30 Re: Surviving connections after internet problem
Previous Message Durumdara 2016-11-08 10:32:05 Re: Surviving connections after internet problem