[Maria-discuss] writing plugin with .net language (C#)
Hi guys, I have a program wrote in c#, it process some code and the result is a struct (an array of string/double/int) I want to include this program inside mariadb server as a daemon plugin (to process data) + a storage engine (to read struct data) is that possible? considering that i can write dll with .net? what about write this to linux (.so files) ? any help is very very very welcome -- Roberto Spadim
Vote for https://dev.mysql.com/worklog/task/?id=820
Most of the work has been already done... If there is sufficient number of
people asking for the feature, such that the MariaDB captains want the
feature, it won't take very long to port it to MariaDB.
On 13 September 2015 at 18:11, Roberto Spadim
Hi guys, I have a program wrote in c#, it process some code and the result is a struct (an array of string/double/int) I want to include this program inside mariadb server as a daemon plugin (to process data) + a storage engine (to read struct data)
is that possible? considering that i can write dll with .net? what about write this to linux (.so files) ?
any help is very very very welcome
-- Roberto Spadim
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Antony T Curtis 0523 C487 9187 6972 6894 AEC7 3087 F819 B477 B687
Hi, Roberto! On Sep 13, Roberto Spadim wrote:
Hi guys, I have a program wrote in c#, it process some code and the result is a struct (an array of string/double/int) I want to include this program inside mariadb server as a daemon plugin (to process data) + a storage engine (to read struct data)
is that possible? considering that i can write dll with .net? what about write this to linux (.so files) ?
I think it's possible, why not? You might need a thin layer of the interface code in C (seeing your code, I believe you can do that easily :), and the main logic in C#. On Linux you can, perhaps, use Mono. But I haven't heard of anyone doing that, so I don't know of any specific pitfalls that you might face on this way. Regards, Sergei
Hi guys!
Nice :) +1 for this job, i will try
Em segunda-feira, 14 de setembro de 2015, Sergei Golubchik
Hi, Roberto!
On Sep 13, Roberto Spadim wrote:
Hi guys, I have a program wrote in c#, it process some code and the result is a struct (an array of string/double/int) I want to include this program inside mariadb server as a daemon plugin (to process data) + a storage engine (to read struct data)
is that possible? considering that i can write dll with .net? what about write this to linux (.so files) ?
I think it's possible, why not? You might need a thin layer of the interface code in C (seeing your code, I believe you can do that easily :), and the main logic in C#. On Linux you can, perhaps, use Mono.
But I haven't heard of anyone doing that, so I don't know of any specific pitfalls that you might face on this way.
Regards, Sergei
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
Hi,
You could try:
class DaemonPlugin
{
[DllExport("add",CallingConvention = CallingConvention.Cdecl)]
public static int add(int left, int right)
{
return left + right;
}
}
Then write a C++ wrapper around the exported classes. I don't think C#
will be able to handle the pointers from the MySQL plugin API (or to do so
would be tremendously cumbersome) so a wrapper around the .NET exported
.NET code which handles the C memory management, etc, needed for a plugin
will work best.
I don't know much about this. I learned the above from a few google
searches, but hopefully it will get you going in the right direction.
Regards,
--Justin
On Mon, Sep 14, 2015 at 4:15 AM, Roberto Spadim
Hi guys! Nice :) +1 for this job, i will try
Em segunda-feira, 14 de setembro de 2015, Sergei Golubchik < serg@mariadb.org> escreveu:
Hi, Roberto!
On Sep 13, Roberto Spadim wrote:
Hi guys, I have a program wrote in c#, it process some code and the result is a struct (an array of string/double/int) I want to include this program inside mariadb server as a daemon plugin (to process data) + a storage engine (to read struct data)
is that possible? considering that i can write dll with .net? what about write this to linux (.so files) ?
I think it's possible, why not? You might need a thin layer of the interface code in C (seeing your code, I believe you can do that easily :), and the main logic in C#. On Linux you can, perhaps, use Mono.
But I haven't heard of anyone doing that, so I don't know of any specific pitfalls that you might face on this way.
Regards, Sergei
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
Hi all!
yes justin, probably a c++ and a c# interface
well next weeks maybe i will start some tests :)
thanks a lot for a first direction, i was looking about pinvoke, etc etc,
like mysqld/mariadb do at plugins :)
2015-09-14 12:40 GMT-03:00 Justin Swanhart
Hi,
You could try:
class DaemonPlugin { [DllExport("add",CallingConvention = CallingConvention.Cdecl)] public static int add(int left, int right) { return left + right; } }
Then write a C++ wrapper around the exported classes. I don't think C# will be able to handle the pointers from the MySQL plugin API (or to do so would be tremendously cumbersome) so a wrapper around the .NET exported .NET code which handles the C memory management, etc, needed for a plugin will work best.
I don't know much about this. I learned the above from a few google searches, but hopefully it will get you going in the right direction.
Regards,
--Justin
On Mon, Sep 14, 2015 at 4:15 AM, Roberto Spadim
wrote: Hi guys! Nice :) +1 for this job, i will try
Em segunda-feira, 14 de setembro de 2015, Sergei Golubchik < serg@mariadb.org> escreveu:
Hi, Roberto!
Hi guys, I have a program wrote in c#, it process some code and the result is a struct (an array of string/double/int) I want to include this program inside mariadb server as a daemon
On Sep 13, Roberto Spadim wrote: plugin (to
process data) + a storage engine (to read struct data)
is that possible? considering that i can write dll with .net? what about write this to linux (.so files) ?
I think it's possible, why not? You might need a thin layer of the interface code in C (seeing your code, I believe you can do that easily :), and the main logic in C#. On Linux you can, perhaps, use Mono.
But I haven't heard of anyone doing that, so I don't know of any specific pitfalls that you might face on this way.
Regards, Sergei
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
guys , i'm still with doubts... but not more about c#, now about c++
i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb
makefiles etc etc?
2015-09-18 1:40 GMT-03:00 Roberto Spadim
Hi all!
yes justin, probably a c++ and a c# interface
well next weeks maybe i will start some tests :)
thanks a lot for a first direction, i was looking about pinvoke, etc etc, like mysqld/mariadb do at plugins :)
2015-09-14 12:40 GMT-03:00 Justin Swanhart
: Hi,
You could try:
class DaemonPlugin { [DllExport("add",CallingConvention = CallingConvention.Cdecl)] public static int add(int left, int right) { return left + right; } }
Then write a C++ wrapper around the exported classes. I don't think C# will be able to handle the pointers from the MySQL plugin API (or to do so would be tremendously cumbersome) so a wrapper around the .NET exported .NET code which handles the C memory management, etc, needed for a plugin will work best.
I don't know much about this. I learned the above from a few google searches, but hopefully it will get you going in the right direction.
Regards,
--Justin
On Mon, Sep 14, 2015 at 4:15 AM, Roberto Spadim
wrote: Hi guys! Nice :) +1 for this job, i will try
Em segunda-feira, 14 de setembro de 2015, Sergei Golubchik < serg@mariadb.org> escreveu:
Hi, Roberto!
Hi guys, I have a program wrote in c#, it process some code and the result is a struct (an array of string/double/int) I want to include this program inside mariadb server as a daemon
On Sep 13, Roberto Spadim wrote: plugin (to
process data) + a storage engine (to read struct data)
is that possible? considering that i can write dll with .net? what about write this to linux (.so files) ?
I think it's possible, why not? You might need a thin layer of the interface code in C (seeing your code, I believe you can do that easily :), and the main logic in C#. On Linux you can, perhaps, use Mono.
But I haven't heard of anyone doing that, so I don't know of any specific pitfalls that you might face on this way.
Regards, Sergei
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
Hi, Roberto! On Sep 18, Roberto Spadim wrote:
guys , i'm still with doubts... but not more about c#, now about c++ i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care. Regards, Sergei
Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
Hi, Roberto!
On Sep 18, Roberto Spadim wrote:
guys , i'm still with doubts... but not more about c#, now about c++ i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
:D nice
what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked
list "feed" (something like: clear list, delete from position x to y,
delete position x, insert at position x, update position x, move position x
to y)
2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking
about using a mysql handler api) (i didn't check how it works, but i think
handler sock use it)
3) keep the double linked list at memory (reconstruct the list when server
shutdown, maybe make some snapshots to avoid a long reconstruct, something
like after X lines of feed, save the list, or after x minutes)
4) a engine to read the double linked list at memory (i don't know yet how
do this, but i will need some control about reading a shared memory, how to
access this shared memory from daemon plugin using storage engine)
5) a engine to read information about what daemon is doing (like 4)
6) at same plugin daemon, create a tcp/ip connection to "export" the same
feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads,
atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was
my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: Hi, Roberto!
On Sep 18, Roberto Spadim wrote:
guys , i'm still with doubts... but not more about c#, now about c++ i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h
you have a C code, right?
and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h
what this do?
"
extern "C" { "
those functions should be undestood as "C" instead of "C++", or compiler
should "export" those c++ function to "C" "code", or something related to C
and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
:D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: Hi, Roberto!
On Sep 18, Roberto Spadim wrote:
guys , i'm still with doubts... but not more about c#, now about c++ i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
extern "C" { Makes the function use CDECL calling conventions, which is equivalent to setting the .NET code to use CDECL calling conventions. Any language that supports exporting symbols with CDECL calling conventions supports interoperating with C (it stands for C declarations aka C calling conventions). --Justin Sent from my iPhone
On Oct 3, 2015, at 1:57 PM, Roberto Spadim
wrote: sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h you have a C code, right? and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h what this do?
" extern "C" { " those functions should be undestood as "C" instead of "C++", or compiler should "export" those c++ function to "C" "code", or something related to C and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
: :D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: Hi, Roberto! On Sep 18, Roberto Spadim wrote:
guys , i'm still with doubts... but not more about c#, now about c++ i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
hummm, it's like creating a ".dll" that export functions to other program
call it? in this case your fast bit UDF functions export init/denit
functions to mysql, right? and you are using C++ or C language when you use
"extern"? i don't know how compiler know if it's a C or C++ code
2015-10-03 20:36 GMT-03:00 Justin Swanhart
extern "C" {
Makes the function use CDECL calling conventions, which is equivalent to setting the .NET code to use CDECL calling conventions. Any language that supports exporting symbols with CDECL calling conventions supports interoperating with C (it stands for C declarations aka C calling conventions).
--Justin
Sent from my iPhone
On Oct 3, 2015, at 1:57 PM, Roberto Spadim
wrote: sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h you have a C code, right? and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h what this do?
" extern "C" { " those functions should be undestood as "C" instead of "C++", or compiler should "export" those c++ function to "C" "code", or something related to C and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
: :D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: Hi, Roberto!
On Sep 18, Roberto Spadim wrote:
guys , i'm still with doubts... but not more about c#, now about c++ i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
Hi Roberto,
you could have a try at it with Golang, it can wrap C code easily
https://golang.org/cmd/cgo/
Best regards,
Guillaume Lefranc
RemoteDBA Services Manager - MariaDB Corporation Ab
On Sun, Oct 4, 2015 at 3:26 AM, Roberto Spadim
hummm, it's like creating a ".dll" that export functions to other program call it? in this case your fast bit UDF functions export init/denit functions to mysql, right? and you are using C++ or C language when you use "extern"? i don't know how compiler know if it's a C or C++ code
2015-10-03 20:36 GMT-03:00 Justin Swanhart
: extern "C" {
Makes the function use CDECL calling conventions, which is equivalent to setting the .NET code to use CDECL calling conventions. Any language that supports exporting symbols with CDECL calling conventions supports interoperating with C (it stands for C declarations aka C calling conventions).
--Justin
Sent from my iPhone
On Oct 3, 2015, at 1:57 PM, Roberto Spadim
wrote: sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h you have a C code, right? and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h what this do?
" extern "C" { " those functions should be undestood as "C" instead of "C++", or compiler should "export" those c++ function to "C" "code", or something related to C and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
: :D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: Hi, Roberto!
On Sep 18, Roberto Spadim wrote:
guys , i'm still with doubts... but not more about c#, now about c++ i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
Hello, On Sun, Oct 4, 2015 at 9:05 AM, Guillaume Lefranc < guillaume.lefranc@mariadb.com> wrote:
Hi Roberto,
you could have a try at it with Golang, it can wrap C code easily https://golang.org/cmd/cgo/
Though with Go1.5 its now possible, uninstalling the plugins still leads to segfaults. And sadly, looks like it can't be fixed (not in near future, at least). https://github.com/golang/go/issues/12582 Best, Nirbhay Best regards,
Guillaume Lefranc RemoteDBA Services Manager - MariaDB Corporation Ab
On Sun, Oct 4, 2015 at 3:26 AM, Roberto Spadim
wrote: hummm, it's like creating a ".dll" that export functions to other program call it? in this case your fast bit UDF functions export init/denit functions to mysql, right? and you are using C++ or C language when you use "extern"? i don't know how compiler know if it's a C or C++ code
2015-10-03 20:36 GMT-03:00 Justin Swanhart
: extern "C" {
Makes the function use CDECL calling conventions, which is equivalent to setting the .NET code to use CDECL calling conventions. Any language that supports exporting symbols with CDECL calling conventions supports interoperating with C (it stands for C declarations aka C calling conventions).
--Justin
Sent from my iPhone
On Oct 3, 2015, at 1:57 PM, Roberto Spadim
wrote: sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h you have a C code, right? and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h what this do?
" extern "C" { " those functions should be undestood as "C" instead of "C++", or compiler should "export" those c++ function to "C" "code", or something related to C and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
: :D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: Hi, Roberto!
On Sep 18, Roberto Spadim wrote: > guys , i'm still with doubts... but not more about c#, now about c++ > i was thinking about rewrite the code with c++ > > my doubt is.... could i use C++ 11 ? or i will have problem with mariadb > makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
hummm very nice, i never tried to write a udf with go
going back to daemond plugin, i'm with some doubts, i could make a daemond,
i could make a information schema
both are "easy" my doubt now is how to get data from daemond with
information schema plugin, that's something that i don't know how to solve
yet
i'm reading the show plugins function and trying to understand how to do
this, but no results yet
2015-10-04 17:51 GMT-03:00 Nirbhay Choubey
Hello,
On Sun, Oct 4, 2015 at 9:05 AM, Guillaume Lefranc < guillaume.lefranc@mariadb.com> wrote:
Hi Roberto,
you could have a try at it with Golang, it can wrap C code easily https://golang.org/cmd/cgo/
Though with Go1.5 its now possible, uninstalling the plugins still leads to segfaults. And sadly, looks like it can't be fixed (not in near future, at least).
https://github.com/golang/go/issues/12582
Best, Nirbhay
Best regards,
Guillaume Lefranc RemoteDBA Services Manager - MariaDB Corporation Ab
On Sun, Oct 4, 2015 at 3:26 AM, Roberto Spadim
wrote: hummm, it's like creating a ".dll" that export functions to other program call it? in this case your fast bit UDF functions export init/denit functions to mysql, right? and you are using C++ or C language when you use "extern"? i don't know how compiler know if it's a C or C++ code
2015-10-03 20:36 GMT-03:00 Justin Swanhart
: extern "C" {
Makes the function use CDECL calling conventions, which is equivalent to setting the .NET code to use CDECL calling conventions. Any language that supports exporting symbols with CDECL calling conventions supports interoperating with C (it stands for C declarations aka C calling conventions).
--Justin
Sent from my iPhone
On Oct 3, 2015, at 1:57 PM, Roberto Spadim
wrote: sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h you have a C code, right? and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h what this do?
" extern "C" { " those functions should be undestood as "C" instead of "C++", or compiler should "export" those c++ function to "C" "code", or something related to C and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
: :D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: > Hi, Roberto! > > On Sep 18, Roberto Spadim wrote: > > guys , i'm still with doubts... but not more about c#, now about > c++ > > i was thinking about rewrite the code with c++ > > > > my doubt is.... could i use C++ 11 ? or i will have problem with > mariadb > > makefiles etc etc? > > Sure, you can use any language you want, C++11 is perfectly fine > too. > cmake doesn't care. > > Regards, > Sergei > > _______________________________________________ > Mailing list: https://launchpad.net/~maria-discuss > Post to : maria-discuss@lists.launchpad.net > Unsubscribe : https://launchpad.net/~maria-discuss > More help : https://help.launchpad.net/ListHelp >
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
Hi,
There is no established API for the daemon plugin to communicate with the
server in any way. It is pretty much a drone. The daemon plugin should
have a TCP accept thread. A text protocol would read/write from/to the
daemon plugin. The INFORMATION_SCHEMA plugin would connect to the TCP
socket, request data, then write it to the user for example. I'm not that
familiar with INFORMATION_SCHEMA plugins myself, but this should be
feasible.
You really should probably just use the storage engine interface though.
The storage engine can have your linked list and you can project out
results with select, and modify data with insert/update/delete.
--Justin
--Justin
On Sun, Oct 4, 2015 at 2:05 PM, Roberto Spadim
hummm very nice, i never tried to write a udf with go
going back to daemond plugin, i'm with some doubts, i could make a daemond, i could make a information schema both are "easy" my doubt now is how to get data from daemond with information schema plugin, that's something that i don't know how to solve yet
i'm reading the show plugins function and trying to understand how to do this, but no results yet
2015-10-04 17:51 GMT-03:00 Nirbhay Choubey
: Hello,
On Sun, Oct 4, 2015 at 9:05 AM, Guillaume Lefranc < guillaume.lefranc@mariadb.com> wrote:
Hi Roberto,
you could have a try at it with Golang, it can wrap C code easily https://golang.org/cmd/cgo/
Though with Go1.5 its now possible, uninstalling the plugins still leads to segfaults. And sadly, looks like it can't be fixed (not in near future, at least).
https://github.com/golang/go/issues/12582
Best, Nirbhay
Best regards,
Guillaume Lefranc RemoteDBA Services Manager - MariaDB Corporation Ab
On Sun, Oct 4, 2015 at 3:26 AM, Roberto Spadim
wrote: hummm, it's like creating a ".dll" that export functions to other program call it? in this case your fast bit UDF functions export init/denit functions to mysql, right? and you are using C++ or C language when you use "extern"? i don't know how compiler know if it's a C or C++ code
2015-10-03 20:36 GMT-03:00 Justin Swanhart
: extern "C" {
Makes the function use CDECL calling conventions, which is equivalent to setting the .NET code to use CDECL calling conventions. Any language that supports exporting symbols with CDECL calling conventions supports interoperating with C (it stands for C declarations aka C calling conventions).
--Justin
Sent from my iPhone
On Oct 3, 2015, at 1:57 PM, Roberto Spadim
wrote: sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h you have a C code, right? and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h what this do?
" extern "C" { " those functions should be undestood as "C" instead of "C++", or compiler should "export" those c++ function to "C" "code", or something related to C and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
: :D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: > Hi, > > My fastbit UDF use C++ 11 no problem. > > https://github.com/greenlion/FastBit_UDF > > On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
> wrote: > >> Hi, Roberto! >> >> On Sep 18, Roberto Spadim wrote: >> > guys , i'm still with doubts... but not more about c#, now about >> c++ >> > i was thinking about rewrite the code with c++ >> > >> > my doubt is.... could i use C++ 11 ? or i will have problem with >> mariadb >> > makefiles etc etc? >> >> Sure, you can use any language you want, C++11 is perfectly fine >> too. >> cmake doesn't care. >> >> Regards, >> Sergei >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~maria-discuss >> Post to : maria-discuss@lists.launchpad.net >> Unsubscribe : https://launchpad.net/~maria-discuss >> More help : https://help.launchpad.net/ListHelp >> > > -- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
Hi, With CDECL you are controlling the calling convention of the specified procedure or procedure when it is exported into the symbol table in the library. That is, how symbols are named, how the stack is set up when jumping to the location of the routine in the library, etc. It doesn't matter what the source code is written in, it all compiles to machine code, but the code has to know how to "talk" to the other code. C/C++ can link to .so or .dll built from any language as long as the language exports the symbols with CDECL. The LINKER and the compiler both care about the calling convention because that is how the calls are executed in the library. The Fastbit UDF exports the symbols that MySQL (written in C) using CDECL so that the dynamic loader can find and run the functions when you load the plugin. --Justin Sent from my iPhone
On Oct 3, 2015, at 6:26 PM, Roberto Spadim
wrote: hummm, it's like creating a ".dll" that export functions to other program call it? in this case your fast bit UDF functions export init/denit functions to mysql, right? and you are using C++ or C language when you use "extern"? i don't know how compiler know if it's a C or C++ code
2015-10-03 20:36 GMT-03:00 Justin Swanhart
: extern "C" {
Makes the function use CDECL calling conventions, which is equivalent to setting the .NET code to use CDECL calling conventions. Any language that supports exporting symbols with CDECL calling conventions supports interoperating with C (it stands for C declarations aka C calling conventions).
--Justin
Sent from my iPhone
On Oct 3, 2015, at 1:57 PM, Roberto Spadim
wrote: sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h you have a C code, right? and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h what this do?
" extern "C" { " those functions should be undestood as "C" instead of "C++", or compiler should "export" those c++ function to "C" "code", or something related to C and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
: :D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: Hi, Roberto! On Sep 18, Roberto Spadim wrote: > guys , i'm still with doubts... but not more about c#, now about c++ > i was thinking about rewrite the code with c++ > > my doubt is.... could i use C++ 11 ? or i will have problem with mariadb > makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
nice, now i know more about how dynamic loader works, in other words the
pluging code just need to know CDECL calls
i have another problem, if i need to read data from the daemond plugin
using a information schema plugin, hwo could i:
1) search the plugin at mariadb code?
2) how to lock the data to daemond don't change while i'm reading (mutex or
read/write lock)
3) how to read the data
4) how to unlock the data
5) how to unload the daemon plugin without broken the information schema
plugin (a running read)
it's two plugins "communicating" inside mariadb server processes
about golang, it's something like run a C code inside mariadb and use GO
language as 'higher level language'? i'm seeing that any language with
CDECL could work, right? cgo, .net, c, c++, and others
2015-10-04 10:21 GMT-03:00 Justin Swanhart
Hi,
With CDECL you are controlling the calling convention of the specified procedure or procedure when it is exported into the symbol table in the library. That is, how symbols are named, how the stack is set up when jumping to the location of the routine in the library, etc.
It doesn't matter what the source code is written in, it all compiles to machine code, but the code has to know how to "talk" to the other code. C/C++ can link to .so or .dll built from any language as long as the language exports the symbols with CDECL.
The LINKER and the compiler both care about the calling convention because that is how the calls are executed in the library.
The Fastbit UDF exports the symbols that MySQL (written in C) using CDECL so that the dynamic loader can find and run the functions when you load the plugin.
--Justin
Sent from my iPhone
On Oct 3, 2015, at 6:26 PM, Roberto Spadim
wrote: hummm, it's like creating a ".dll" that export functions to other program call it? in this case your fast bit UDF functions export init/denit functions to mysql, right? and you are using C++ or C language when you use "extern"? i don't know how compiler know if it's a C or C++ code
2015-10-03 20:36 GMT-03:00 Justin Swanhart
: extern "C" {
Makes the function use CDECL calling conventions, which is equivalent to setting the .NET code to use CDECL calling conventions. Any language that supports exporting symbols with CDECL calling conventions supports interoperating with C (it stands for C declarations aka C calling conventions).
--Justin
Sent from my iPhone
On Oct 3, 2015, at 1:57 PM, Roberto Spadim
wrote: sorry guys, i'm a bit confuse about c++ and c
i'm reading your fastbit udf code
at /fb_udf.h you have a C code, right? and at fb_udf.cpp a c++ code
you can mix c and c++ at the same code?
at udf.h what this do?
" extern "C" { " those functions should be undestood as "C" instead of "C++", or compiler should "export" those c++ function to "C" "code", or something related to C and namespaces ?
sorry it's not mysql specific but i'm not finding some C++ plugins examples
2015-09-21 13:43 GMT-03:00 Roberto Spadim
: :D nice what i will is something like:
1) a plugin daemon that receive a tcp/ip connection with a double linked list "feed" (something like: clear list, delete from position x to y, delete position x, insert at position x, update position x, move position x to y) 2) save this feed to a myisam/spider/innodb/anyother engine (i'm thinking about using a mysql handler api) (i didn't check how it works, but i think handler sock use it) 3) keep the double linked list at memory (reconstruct the list when server shutdown, maybe make some snapshots to avoid a long reconstruct, something like after X lines of feed, save the list, or after x minutes) 4) a engine to read the double linked list at memory (i don't know yet how do this, but i will need some control about reading a shared memory, how to access this shared memory from daemon plugin using storage engine) 5) a engine to read information about what daemon is doing (like 4) 6) at same plugin daemon, create a tcp/ip connection to "export" the same feed to others users (just a proxy, not a big problem)
at top level i think i will have 1 daemon plugin + 1 storage engine plugin
i'm thinking about c++ 11 cause it have double linked lists, threads, atomic, sockets, and i dont need others libs (maybe i'm wrong, but that was my first impression about c++11)
2015-09-21 13:34 GMT-03:00 Justin Swanhart
: Hi,
My fastbit UDF use C++ 11 no problem.
https://github.com/greenlion/FastBit_UDF
On Fri, Sep 18, 2015 at 11:52 PM, Sergei Golubchik
wrote: Hi, Roberto!
On Sep 18, Roberto Spadim wrote:
guys , i'm still with doubts... but not more about c#, now about c++ i was thinking about rewrite the code with c++
my doubt is.... could i use C++ 11 ? or i will have problem with mariadb makefiles etc etc?
Sure, you can use any language you want, C++11 is perfectly fine too. cmake doesn't care.
Regards, Sergei
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
-- Roberto Spadim SPAEmpresarial - Software ERP Eng. Automação e Controle
participants (6)
-
Antony T Curtis
-
Guillaume Lefranc
-
Justin Swanhart
-
Nirbhay Choubey
-
Roberto Spadim
-
Sergei Golubchik