Hi Sjoerd, Alastair,
There is a chance that you could compile your UDF as a standalone shared lib with the C++ compiler with the top level interfaces declared extern "C" but I couldn't be sure it would work.
You should also be able to build MonetDB yourself and point to that for compilation of extra stuff. Just point the PKG_CONFIG_PATH environment variable to the directory where monetdb*.pc are installed before calling make in the directory with the above Makefile. You do need the program pkg-config somewhere in your search path.
Do I understand it correctly? The second paragraph tells, that I don't need to wrap the c++ code in C functions, but I can use a simple (g++) Makefile in my UDF folder? I don't quite get what do you mean by "the above Makefile". Is it the make used for the whole build in the MonetDB root folder (used with the configure)? Do I need to alter that configure script too?
If you install the development packages of MonetDB (on Fedora that is MonetDB-devel MonetDB5-server-devel MonetDB-stream-devel) you can compile outside of the MonetDB source tree using a quite simple Makefile.
So I need to install a package from apt-get? I thought I am installing from the sources via make install? And what about the bootstrap script which should find my UDF? How will that function? Thank you very much for clarification. Cheers, Jiri
-----Original Message----- From: users-list [mailto:users-list- bounces+nadvornik.ji=gmail.com@monetdb.org] On Behalf Of Sjoerd Mullender Sent: 31. března 2015 19:41 To: users-list@monetdb.org Subject: Re: C++ user defined function
If you install the development packages of MonetDB (on Fedora that is MonetDB-devel MonetDB5-server-devel MonetDB-stream-devel) you can compile outside of the MonetDB source tree using a quite simple Makefile. Some key contents for the Makefile are (assuming there is a source file reverse.c and some .mal and .sql files that need to be installed):
LIBDIR = `pkg-config --variable=libdir monetdb5` CFLAGS = `pkg-config --cflags monetdb5` LDFLAGS = `pkg-config --libs monetdb5` lib_reverse.so: reverse.o $(CC) -fPIC -DPIC -o lib_reverse.so -shared reverse.o $(LDFLAGS) - Wl,-soname -Wl,lib_reverse.so reverse.o: reverse.c $(CC) -fPIC -DPIC $(CFLAGS) -c reverse.c install: lib_reverse.so cp reverse.mal lib_reverse.so $(LIBDIR)/monetdb5 cp 80_reverse.sql $(LIBDIR)/monetdb5/createdb cp 80_reverse.mal $(LIBDIR)/monetdb5/autoload
You should also be able to build MonetDB yourself and point to that for compilation of extra stuff. Just point the PKG_CONFIG_PATH environment variable to the directory where monetdb*.pc are installed before calling make in the directory with the above Makefile. You do need the program pkg-config somewhere in your search path.
On 03/31/2015 06:24 PM, Alastair McKinley wrote:
If you can separate the usage of MonetDB provided includes and functions from your core UDF logic you could build a small wrapper in C that links to a shared lib built with C++ with your interfaces declared extern "C".
There is a chance that you could compile your UDF as a standalone shared lib with the C++ compiler with the top level interfaces declared extern "C" but I couldn't be sure it would work.
Best regards,
Alastair
The resulting shared library should be loadable.
On Tue, 2015-03-31 at 17:50 +0200, Jiří Nádvorník wrote:
Hi,
I’m trying to write a function in C++ and I thought I would just provide a makefile for it in my custom folder in MonetDB/sql/backends/monet5/CUSTOM. But it seems like all of the Makefiles in UDF sample are generated by the bootstrap.
How do I get over this? I need to use external C++ libraries in the makefile..
Thank you for help.
Best regards,
Jiri Nadvornik Astronomical Institute AV CR Stellar department Czech Republic nadvornik.ji@gmail.com
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- Sjoerd Mullender