Does Yugabyte Support C-Language Functions?

I’m wondering if Yugabyte supports compiling and linking dynamically-loaded functions? Basically I’m attempting to compile a file functions.c with the following command:

cc -fPIC -c -I/yugabyte- functions.c

but this results in an error →

/yugabyte- fatal error: yb/common/ybc_util.h: No such file or directory
#include “yb/common/ybc_util.h”

Not sure if I am missing something or if it’s just not a supported option.

Hi @lambgoesbaa yes, that’s not yet supported in the sense that it needs to update the header files I guess. Can you explain what you want to achieve? We are also looking at the possibility to use other languages like python, which will probably be easier and fit many goals

Hi @FranckPachot, I was going to update later in the day. The long term goal is moving databases from SQL Server to Yugabyte, and part of that is porting over for example our custom aggregates written in .NET managed code.

I’ve managed to compile c code over the header files from a standard PostgreSQL 11 install and use the CREATE FUNCTION ysql statement to create the function.

This seems to do the trick. :smile:

python support would be great, not sure if that fits our timeline though.

1 Like

Awesome, yes compiling on PostgreSQL is what I do for extensions as well :+1:
About moving from SQL Server, not a solution if your timeline is short, but there’s work ongoing to merge to PostgreSQL 13 and we will look at Babelfish patches