codeplea/tinyexpr

how to use this project in mysql udf?

IRGC opened this issue · 3 comments

IRGC commented

i want to use this in mysql udf
sample code here https://github.com/MariaDB/server/blob/10.3/sql/udf_example.c

i just tried to #include tinyexpr.h
then use

double r = te_interp(input, 0);
        return r;

it shows error
mcalc.cc:82:31: error: 'te_interp' was not declared in this scope

IRGC commented

sorry, i managed to fix it.
thanks.

IRGC, I've been working on this exact same issue on and off for a year can you provide any examples on how you solved the issue of including the tinyexpr library?

Actually, figured it out as well. added tinyexpr.c to the makefile
ADD_LIBRARY(udf_EvalFormula MODULE udf_EvalFormula.cc udf_EvalFormula.def tinyexpr.c)
And with a few error changes, it compiled and is up and running.