Newbie: Plugin examples for Dev-C++?

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
markman
Junior Member
Junior Member
Posts: 4
Joined: 2003-10-07, 13:43 UTC

Newbie: Plugin examples for Dev-C++?

Post by *markman »

Hi,
I would like to try to make a TC plugin (lister). I'm using Dev-C++ with mingw. It would be much easier to start from an existing Dev-C++ project and therefore I would like to know if someone know if/where I can find such a project?
Thanks
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2markman

take a look at this:

https://plugins.ghisler.com/lsplugins/listplugsample.zip

it's a Microsoft Visual Studio Project.
markman
Junior Member
Junior Member
Posts: 4
Joined: 2003-10-07, 13:43 UTC

Post by *markman »

Thank you for the help.
I imported the VS Project to Dev-C++ and compiled it as an dll. (I hope I'm on the right track here. It generated a def file which looks ok). When I renamed the dll and tried to load it in TC it says it is not a valid plugin. I'm starting to think that I'm missing something important. Are wlx files dlls? Is it something else I have to do. I'm I completely lost?
I appreciate the help
Jonas
Senior Member
Senior Member
Posts: 325
Joined: 2003-05-27, 16:59 UTC
Location: Germany
Contact:

Post by *Jonas »

all TC-plugins (wfx, wlx, wcx) are .dll's
http://www.ghisler.com/plugins.htm#lister
there is a details help file how to write a plugin
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48113
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

1. Make sure that the exported functions are not name-mangled. You can see them with the fileinfo lister plugin from our addons page.

2. Make sure your plugin doesn't use any runtime dlls, or if it does, that the dlls are in the windows or windows\system32 directory.
Author of Total Commander
https://www.ghisler.com
rudolf.m
New Member
New Member
Posts: 1
Joined: 2003-11-03, 14:09 UTC

fsplugin with dev-c++

Post by *rudolf.m »

Hi markman,

don't know if you are still interested in using dev-c++ for plugin development but here are the results of my investigations:

I've imported the fsplugin ms visual c++ project in dev-c++ 4.9.7.3
I've changed the project options to generate a Win32 DLL
I tried to compile but got errors in fsplugin.rc

I've commented (removed) the following lines in fsplugin.rc

Code: Select all

#include "afxres.h"
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_SWISS
After that the project compiled successfully but
the plugin did not work because there were no exports.

I tried to provide the original def file so I've changed the linker options (Project options - compiler - linker)

Code: Select all

--def fsplugin.def
After that I got undefined referenc errors.
So I've added

Code: Select all

#define EXPORT extern "C" __declspec(dllexport)
to stdafx.h and changed all function prototypes
in fsplugin.h and all functions in fsplugin.c
which are exported (according to fsplugin.def)
i. e.

Code: Select all

EXPORT int __stdcall FsInit(int....)
...
After that all exported functions were mangled
with tailing characters like FsDeleteFile@12.
So I've added the linker option
(Project-options-compiler-linker)

Code: Select all

--add-stdcall-alias
and it worked.
I was able to install the renamed fsplugin.

I'm pretty sure that there are better ways to
do it - I'm not a real c/dev_c++ guru - but
I was able to install and use the sample
plugin.
Especially that

Code: Select all

EXPORT int __stdcall ...
is a quite obscure for me (comments
are welcome).

I hope that helps.

regards
rm
Symlink
Junior Member
Junior Member
Posts: 18
Joined: 2005-01-21, 14:55 UTC
Location: .at

Post by *Symlink »

Sorry for digging up this old topic, but I just had the problem with the missing afxres.h file and this was the only topic I found.

I tried compiling the sample fsplugin with MSVC 6 (not mingw). It always complained about the afxres.h file missing. When I commented out the two lines you mentioned - the one including afxres.h and the LANGUAGE-thing - it compiled fine. I found a page though which says you should change axfres.h into winres.h. I tried and it worked too.
The resulting files are nearly identical, I think only two bytes are different. Not too sure about what the difference is :-?

Now I will try to understand how such a plugin works :)

Regards,
Sym
Post Reply