← Back to team overview

maria-discuss team mailing list archive

Re: writing plugin with .net language (C#)

 

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 <greenlion@xxxxxxxxx>:

> 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 <roberto@xxxxxxxxxxxxx>
> wrote:
>
>> Hi guys!
>> Nice :) +1 for this job, i will try
>>
>> Em segunda-feira, 14 de setembro de 2015, Sergei Golubchik <
>> serg@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~maria-discuss
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>


-- 
Roberto Spadim
SPAEmpresarial - Software ERP
Eng. Automação e Controle

Follow ups

References