Hi Joe,
You are so kind. Thank you for your reply. I think that I wasn't clear
enough. I know how to parse the HTTP request to access the arguments,
I know how to use the atoi function but now it is not the case.
In that moment when I have the name of the function, ex. f10, I have
this information represented by a char* and it is not the same when you
write your C code. Knowing the function and its parameter I have to
evaluate it somehow. That is why I wrote in my first mail
int n;
"n = f10(2);"
It is like the EVAL in Perl, where you specify the statement, prepared
prior, and it calculates or evaluates it.
What I need is to tell to APR, hey APR please find the function "f10" in
all loaded libraries, then execute the function and give me back the result.
grafl
2010.03.09. 18:16 keltezéssel, Joe Lewis írta:
On Tue, March 9, 2010 6:43 am, Graf, László wrote:
I have a shared library containing a function to calculate a multiple
of 10. The header file (apr_dso_f.h):
int f10(int p1);
I use this library with an APR console application and it woks fine. OK.
My module loads also this SO library at start-up. What I would like to
have is when I access the URL
/gl/f10?p1=2
to call the function f10 with 2 as parameter..., calculate the result and
generate the HTML content containig 20. This means that, when I have
the function's name (f10) and the parameter's value (2) from the
request string I need to evaluate a statement like
int n;
"n = f10(2);"
like EVAL in Perl or JavaScript and use then the n like a C variable.
Is that possible? Can somebody help me?
Yes. Programming 101. If using C, I'd reading up on the following things :
Understand how to parse the request_rec->args (QUERY_STRING) to get the
param.
Read up on "atoi" to convert the text param value into an integer
call directly the n = f10(variable);
Joe