including header files in a C extension

Started by TalGlozover 7 years ago3 messagesgeneral
Jump to latest
#1TalGloz
glozmantal@gmail.com

Hi,

If I have an external library that I install using make install into the
/usr/local/include/libraryname path by default and I want to include it in a
C extension, the Makefile for the .so file includes the headers in
/usr/local/include/libraryname path.

Can I use #include <libraryname/header.h> when writing C/CPP code for my
PostgreSQL C extension or do I have to install the external library in a
different path than /usr/local/include/libraryname. I think that the
external library headers are not getting included.

I do manage to build the .so file without error.....

Thanks,
Tal

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: TalGloz (#1)
Re: including header files in a C extension

TalGloz wrote:

If I have an external library that I install using make install into the
/usr/local/include/libraryname path by default and I want to include it in a
C extension, the Makefile for the .so file includes the headers in
/usr/local/include/libraryname path.

Can I use #include <libraryname/header.h> when writing C/CPP code for my
PostgreSQL C extension or do I have to install the external library in a
different path than /usr/local/include/libraryname. I think that the
external library headers are not getting included.

I do manage to build the .so file without error.....

If you can build the extension, what is your problem?

Usually you use the LDFLAGS to tell "make" where to find your headers.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

#3TalGloz
glozmantal@gmail.com
In reply to: Laurenz Albe (#2)
Re: including header files in a C extension

Hi,

Thanks for the reply but this question doesn't describe my problem. I've
asked the question again with much more detailed information about my
problem and got a solution, please see link below.

http://www.postgresql-archive.org/Linker-errors-while-creating-a-PostgreSQL-C-extension-function-td6034585.html
<http://www.postgresql-archive.org/Linker-errors-while-creating-a-PostgreSQL-C-extension-function-td6034585.html&gt;

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html