Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

IRC plugin; Where to start?

(1/2) > >>

Cualli:
I have a working grasp of C and not much else. I intend to code an IRC plugin because:

A) It'd be useful to hang out in #c or #codeblocks while coding.
B) IRC = Decent collaboration tool. Not a bad idea to talk to other programmers while you work on something.

and

C) I like IRC.

Would anybody like to help me? What do I need to know?

TDragon:

--- Quote from: Cualli on June 09, 2007, 10:54:53 pm ---What do I need to know?

--- End quote ---
C++.

... At least enough of it to interface a C::B plugin in C++ with whatever you choose for the IRC portion.

Ceniza:
It's funny to see, once again, such proposal (search the forums and you will see :wink:).

Just like TDragon said, C++ is the first thing you must know. You will also need some basic knowledge about wxWidgets (interface and sockets), the Code::Blocks' SDK (just check the source of some plugins to get an idea) and you'll need to have the RFC of IRC handy.

Have fun.

Cualli:

--- Quote from: Ceniza on June 10, 2007, 06:04:21 pm ---It's funny to see, once again, such proposal (search the forums and you will see :wink:).

Just like TDragon said, C++ is the first thing you must know. You will also need some basic knowledge about wxWidgets (interface and sockets), the Code::Blocks' SDK (just check the source of some plugins to get an idea) and you'll need to have the RFC of IRC handy.

Have fun.

--- End quote ---

Why is C++ necessary? Is it truly impossible to write it in straight C?

TDragon:

--- Quote from: Cualli on June 11, 2007, 07:52:05 am ---Is it truly impossible to write it in straight C?

--- End quote ---
As far as I know. First, a plugin must define a class which inherits at least from the cbPlugin class. I'll admit that, with a lot of skill and trickery, this can probably be emulated in C -- but, in order to properly register a plugin, C::B needs the plugin DLL to create a static instance of another class, templated on your cbPlugin inheritor. This static instance in turn registers the plugin class with the main C::B program's plugin set (actually, this takes place in codeblocks.dll, but that's irrelevant). The upshot of all this is that C::B merely calls wxWidget's dynamic DLL loading routines, then examines its list of plugins to find the one that's newly loaded.

On the side of the standard C++ plugin, getting this done is quite easy:

--- Code: ---namespace
{
    PluginRegistrant<MyPlugin> reg(_T("MyPlugin"));
}

--- End code ---
Getting that done somehow in C would be a lot harder, I imagine.

Cheers,
John E. / TDM

Navigation

[0] Message Index

[#] Next page

Go to full version