[Geany-Devel] Adding a plugin

Roger Booth rbooth at xxxxx
Sat Jun 8 09:54:38 UTC 2013


On 06/08/2013 02:31 AM, Chow Loong Jin wrote:
> On Sat, Jun 08, 2013 at 05:59:51PM +1000, Lex Trotman wrote:
>> [...]
>> "for non autotools experts" I said, that includes not knowing how to
>> program in m4 :-)
>>
>> Unless you are telling me just cut and paste of the code fragments in
>> hacking is all thats needed?
> Actually cutting and pasting the code fragments in HACKING should be enough for
> most cases. There are also plenty of examples (other plugins) to look at if
> anything extra needs to be done.
>
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
The example below is what I came up with after a few minutes checking 
out your documentation.

It didn't take me long to create this basic plugin. However, I reserve 
the right to bitch about the level of documentation for the data types 
GeanyPlugin, GeanyData and GeanyFunctions, although GeanyFunctions seems 
really transparent, just exposing Geany functions (maybe thats how its 
file name was decided).

As a nit, I don't understand why the plugin_init function is passed the 
GeanyData parameter. Seems superfluous to me. Note that I ignore it in 
the example, and in all plugins I've written to date. Is it not the same 
as the global *geany_data? If not, then I'd say that needs documentation.

One thing I could ask for is a reference in the docs to where I can find 
the correspondence between api and abi. Maybe thats the wrong question, 
but anyway, how do i know which abi version I need? This is in regards 
to PLUGIN_VERSION_CHECK(xxx)

---------------- main.cpp -----------------------------
/*
  * http://www.geany.org/manual/reference/
  * http://www.geany.org/manual/reference/howto.html
  * http://www.geany.org/manual/reference/guidelines.html
  */

#include <geanyplugin.h>

GeanyPlugin         *geany_plugin;
GeanyData           *geany_data;
GeanyFunctions      *geany_functions;

PLUGIN_VERSION_CHECK(211)

PLUGIN_SET_INFO("Hello World", "Just another tool to say hello world",
                 "1.0", "Joe Doe <joe.doe at example.org>");

extern "C" void plugin_init(GeanyData *)
{
}

extern "C" void plugin_cleanup(void)
{
}

------------ makefile -----------------------------

debug/helloworld.so: debug/main.o
     @echo Creating library
     @gcc -o debug/helloworld.so -shared `pkg-config --libs geany` 
debug/main.o

debug/main.o: ../src/main.cpp
     @echo debug/main.o
     @g++ -o debug/main.o -c ../src/main.cpp -I../src -std=gnu++0x -fPIC 
`pkg-config --cflags geany`  -g -ggdb -ggdb3 -ansi -W -Wall -Wundef -O2 
-MT debug/main.o -MF debug/main.o.d -MMD
-include debug/main.o.d



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130608/0ee391ec/attachment.html>


More information about the Devel mailing list