[Maria-developers] I wonder what elements add to CMakeLists.txt

Dears. I'm a newer in maria develper community. I'm develping a simple plugin for monitoring. If I access from other module to my plugin interface, I wonder how and what elements add to CMakeLists.txt. for example, My plugin is daemon type and myplugin.h has a definition of public methodA. I want to use methodA in my plugin from sql/sql_parse.cc . I think that information of library is needed at build time. ( -L, -l option) I don't know how to add that elements to CMakeLists.txt. plz,let me know. Thanks in advance.

Hi, kyung! On Mar 23, kyung nam Kim wrote:
Dears. I'm a newer in maria develper community. I'm develping a simple plugin for monitoring. If I access from other module to my plugin interface, I wonder how and what elements add to CMakeLists.txt.
for example, My plugin is daemon type and myplugin.h has a definition of public methodA. I want to use methodA in my plugin from sql/sql_parse.cc . I think that information of library is needed at build time. ( -L, -l option) I don't know how to add that elements to CMakeLists.txt. plz,let me know.
I'm not sure I understand. You want sql_parse.cc to invoke some methodA from your plugin? But then you plugin won't be a "plugin", because there will not be possible to "plug" it "in" - the server will not compile without it, so you can as well hardcode your functionality directly into the server. May be you want your methodA to invoke some function from sql_parse.cc? Regards, Sergei

Hi, Sergei ! Thanks for your reply, The exact thing I want is invoke a method in my plugin from sql_parse.cc. I want pass some information from sql_parse.cc to methodA in my plugin. ex) myplugin.h ---------------------------- public: void putData(...); sql_parse.cc ----------------------------- .... myplugin->putData(...) how do i modify CMakeLists.txt? Thanks in advance. 2015-03-23 22:32 GMT+09:00 Sergei Golubchik <serg@mariadb.org>:
Hi, kyung!
On Mar 23, kyung nam Kim wrote:
Dears. I'm a newer in maria develper community. I'm develping a simple plugin for monitoring. If I access from other module to my plugin interface, I wonder how and what elements add to CMakeLists.txt.
for example, My plugin is daemon type and myplugin.h has a definition of public methodA. I want to use methodA in my plugin from sql/sql_parse.cc . I think that information of library is needed at build time. ( -L, -l option) I don't know how to add that elements to CMakeLists.txt. plz,let me know.
I'm not sure I understand.
You want sql_parse.cc to invoke some methodA from your plugin?
But then you plugin won't be a "plugin", because there will not be possible to "plug" it "in" - the server will not compile without it, so you can as well hardcode your functionality directly into the server.
May be you want your methodA to invoke some function from sql_parse.cc?
Regards, Sergei

Hi, kyung! On Mar 23, kyung nam Kim wrote:
Hi, Sergei ! Thanks for your reply, The exact thing I want is invoke a method in my plugin from sql_parse.cc.
ex)
myplugin.h ---------------------------- public: void putData(...);
sql_parse.cc ----------------------------- ....
myplugin->putData(...)
how do i modify CMakeLists.txt?
Thanks in advance.
In that case, as I said, it's not a plugin. You can simply put your files in sql/ directory - it could be easier. Otherwise... include your myplugin.h in sql_parse.cc and hopefully it'll work.
I want pass some information from sql_parse.cc to methodA in my plugin.
What kind of information? Regards, Sergei

Hi, Sergei! Thanks for your reply. You asked me about information which I want to send to my plugin. I have a plan to develop monitoring tool for mariadb. I want to develop a agent as a mariadb plugin. Agent collect data from sql_parse.cc (I' don't know exactly where more infomation about performance .) and sends that data to APM (Application Performance Monitoring) Server. and Users use databoard to see that data via APM server. We have already have a APM Server, Dashboard and many kinds of agent. (for server, was). I want to add agent for mariaDB and contribute this community if possible. Your advice is right. It's easier my header file to sql folder. But When I want to develop my agent as a plugin type, I meet error as follows. ============================================ [ 98%] Built target mysqlserver Linking CXX shared library libmysqld.so ../../sql_parse.cc:linenum: undefined reference to 'Mymon::Mymon()' ../../sql_parse.cc:linenum: undefined reference to 'Mymon::putData(THD* thd); .... ================================================================' My source is like this. sql_parse.cc ---------------------------- #include "../plugin/myplugin/plugin.h" .... #ifdef MYMON ... Mymon* mon = new Mymon(); mon->putData(thd); ... CMakeList.txt ---------------------------------------- SET (SQL_SOURCE ..... myplugin.h myplugin.cc ..... In my thought, errors come from the link option . isn't right? how do i fix this build error? Regards, kyongnam. 2015-03-23 23:09 GMT+09:00 Sergei Golubchik <serg@mariadb.org>:
Hi, kyung!
On Mar 23, kyung nam Kim wrote:
Hi, Sergei ! Thanks for your reply, The exact thing I want is invoke a method in my plugin from sql_parse.cc.
ex)
myplugin.h ---------------------------- public: void putData(...);
sql_parse.cc ----------------------------- ....
myplugin->putData(...)
how do i modify CMakeLists.txt?
Thanks in advance.
In that case, as I said, it's not a plugin. You can simply put your files in sql/ directory - it could be easier.
Otherwise... include your myplugin.h in sql_parse.cc and hopefully it'll work.
I want pass some information from sql_parse.cc to methodA in my plugin.
What kind of information?
Regards, Sergei

Hi, kyung! On Mar 23, kyung nam Kim wrote:
Hi, Sergei! Thanks for your reply. You asked me about information which I want to send to my plugin. I have a plan to develop monitoring tool for mariadb. I want to develop a agent as a mariadb plugin. Agent collect data from sql_parse.cc (I' don't know exactly where more infomation about performance .) and sends that data to APM (Application Performance Monitoring) Server. and Users use databoard to see that data via APM server.
We have already have a APM Server, Dashboard and many kinds of agent. (for server, was). I want to add agent for mariaDB and contribute this community if possible.
Right. That's exactly why I ask. We cannot accept your plugin and it'll be of little use to the community (not "of no use", it'll be used, but less than it could've been) if one would need to modify and recompile MariaDB to use your plugin. If you'd like, let's try to figure out whether you can collect your infomation without patching the server. So what data do you need, exactly?
Your advice is right. It's easier my header file to sql folder. But When I want to develop my agent as a plugin type, I meet error as follows. ============================================ [ 98%] Built target mysqlserver Linking CXX shared library libmysqld.so ../../sql_parse.cc:linenum: undefined reference to 'Mymon::Mymon()' ../../sql_parse.cc:linenum: undefined reference to 'Mymon::putData(THD* thd);
Of course. Because you want sql_parse.cc to call your plugin, your plugin *always must be in the server*. You cannot have it as a separate shared object. To do that, add the MANDATORY keyword to your MYSQL_ADD_PLUGIN() declaration in CMakeLists.txt Regards, Sergei
participants (2)
-
kyung nam Kim
-
Sergei Golubchik