topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday April 19, 2024, 10:08 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Plugins in C#  (Read 7657 times)

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Plugins in C#
« on: November 12, 2007, 10:37 AM »
Has anyone yet wrote a wrapper to allow us to write plugins in C#?
I intend to do it if not, a bit worried it wouldn't be fast enough though.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,900
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Plugins in C#
« Reply #1 on: November 12, 2007, 10:53 AM »
It would be *wonderful* if you could create such a thing!  :-*

Please contact me ([email protected]) and i can help a bit.

One of the members of the forum, Okke, did an amazing job making a Delphi wrapper for FARR, and his work will probably be the most help for you since his is an example of how to recreate the C++ wrapper helper functions.

My eternal gratitude and a rare FARR Plugin Creator mug starring our mascot Cody is yours if you can do it :)

Arjen

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 93
    • View Profile
    • Codingspace.org
    • Read more about this member.
    • Donate to Member
Re: Plugins in C#
« Reply #2 on: November 12, 2007, 02:16 PM »
I am interested in this as well. Time allowing I'm willing to help create a wrapper like this. I had a short look at the SDK but have chickened out so far. :-) If I understand correctly, a FARR plugin is a DLL that must expose certain functions. One of the hard things I think will be to map the data types from C++ to C#. Mouser, can you give a short overview of what a plugin should look like?

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Re: Plugins in C#
« Reply #3 on: November 16, 2007, 07:38 AM »
Hey, just a quick update about the C# plugin SDK:

Every C# plugin will consist of two DLLs:
1) The C++\CLI (managed C++) assembly
2) The C# assembly

When FARR loads the C++ plugin it calls its OnInit() function which in turn uses reflection to find its required C# assembly into the memory. Then it is just a matter of passing each function call to the managed extension and converting the data back and forth from managed to unmanaged types.

When it is done, the idea is that the C# developer wouldn't be aware of the C++ plugin at all, he'll just need to add a reference to my managed C++ assembly, inherit from a certain base class and override the functions he wants to.  I'll have a VERY basic (just one function) prototype working today, probably.

Right now I have most of the basic functionality built in and I believe I can do the first real C# plugin in the next days.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,900
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Plugins in C#
« Reply #4 on: November 16, 2007, 08:19 AM »
Sounds like a good way to do it  :up: