Description of problem: muParserDLL.h assumes it runs on Windows and the underlying code is omitted if compiled on non-Windows. Version-Release number of selected component (if applicable): 1.27 How reproducible: always Steps to Reproduce: 1. create a testprogram that uses muParserDLL.h 2. compile 3. Actual results: doesn't compiles Expected results: it should compile and work Additional info:
Created attachment 157047 [details] Allow using muParserDLL.h on non-Windows systems
You have take the wrong file. When you look at the documentation you will see that you must include muParser.h on all platforms. The muParserDLL.h is only needed to export the symbols for the Microsoft compiler when build on windows.
NOTABUG isn't right. I would like to use the "DLL" interface functions from C code, not the C++ interface. And link the resulting .o or .so into a larger C program. And this is not accessible on Linux as muParser 1.27 stands. Here's an example of what I would like to do, a custom SPI module for PostgreSQL. ----8<--------- test1.cc ---------8<---- #include <muParser.h> extern "C" { #include "postgres.h" #include "fmgr.h" #include "utils/elog.h" extern Datum test1(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(test1); Datum test1(PG_FUNCTION_ARGS) { char *formula = "3 * 7"; parser_handle hParser; double val; hParser = mupInit(); mupSetExpr(hParser, formula); val = mupEval(hParser); ereport(NOTICE, (errmsg("%lf", val))); mupRelease(hParser); PG_RETURN_NULL(); } } ----8<--------- test1.cc ---------8<---- I get this when using only <muParser.h>: $ USE_PGXS=1 make g++ -fpic -I. -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -c -o test1.o test1.cc test1.cc: In function ‘Datum test1(FunctionCallInfoData*)’: test1.cc:15: error: ‘parser_handle’ was not declared in this scope test1.cc:15: error: expected `;' before ‘hParser’ test1.cc:18: error: ‘hParser’ was not declared in this scope test1.cc:18: error: ‘mupInit’ was not declared in this scope test1.cc:20: error: ‘mupSetExpr’ was not declared in this scope test1.cc:21: error: ‘mupEval’ was not declared in this scope test1.cc:25: error: ‘mupRelease’ was not declared in this scope make: *** [test1.o] Error 1 So to use the "DLL interface" I explicitly need to include <muParserDLL.h>. But with the original code, I get this: In file included from test1.cc:1: /usr/include/muParserDLL.h:43:21: error: windows.h: No such file or directory /usr/include/muParserDLL.h:63: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:64: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:65: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:66: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:67: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:68: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:70: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:73: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:74: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:75: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:76: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:77: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:79: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:80: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:81: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:83: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:84: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:85: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:86: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:87: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:88: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:89: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:92: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:93: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:94: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:97: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:98: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:99: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:100: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:103: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:104: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:105: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:106: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:107: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:108: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:111: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:114: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:115: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:116: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:117: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:118: error: expected constructor, destructor, or type conversion before ‘(’ token /usr/include/muParserDLL.h:119: error: expected constructor, destructor, or type conversion before ‘(’ token test1.cc: In function ‘Datum test1(FunctionCallInfoData*)’: test1.cc:18: error: ‘mupInit’ was not declared in this scope test1.cc:20: error: ‘mupSetExpr’ was not declared in this scope test1.cc:21: error: ‘mupEval’ was not declared in this scope test1.cc:25: error: ‘mupRelease’ was not declared in this scope make: *** [test1.o] Error 1 The patch is needed for C code to use and successfully link with -lmuparser. I also sent the patch to the muParser mainstream maintainer for consideration.
Please add more infos for the next report, so that it will much cleaner what you have done and what will not work. Please check the new one in the testing repo.
muParser-1.27-5.fc7 has been pushed to the Fedora 7 testing repository. If problems still persist, please make note of it in this bug report.
muParser-1.27-5.fc7 has been pushed to the Fedora 7 stable repository. If problems still persist, please make note of it in this bug report.