mIRC Home    About    Download    Register    News    Help

Print Thread
#186495 23/09/07 04:56 PM
Joined: Sep 2007
Posts: 4
B
bLasT Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Sep 2007
Posts: 4
Hi, I'm trying to learn how to make a dll file for mirc, but i need some help.
I was trying to create the .dll using Dev-cpp and I think I need to make a .def file to export my functions because when i try to use the .dll with the /dll command on mirc it says it can't find the funciton.
Is there a way to make a .def file using Dev-cpp or exporting these functions by any other way?

I am an expert mirc scripter and I understand a good bit of C/C++ so that you know how to answer me.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Declare your functions like this:

Code:
extern "C" _declspec(dllexport) int FunctionName(HWND,HWND,char*,char*,BOOL,BOOL)
{
}

Joined: Sep 2007
Posts: 4
B
bLasT Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Sep 2007
Posts: 4
ok thx i'll try later

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
If you're talking about Dev-C++ the freeware IDE, you're actually using MingW to compile, not Dev-C++.. the compiler is more important than the IDE you're on

in MingW you'd use __declspec(dllexport) to export a DLL symbol without a .def file

See http://sig9.com/node/35


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Sep 2007
Posts: 4
B
bLasT Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Sep 2007
Posts: 4
yes thx it works

Joined: Sep 2007
Posts: 4
B
bLasT Offline OP
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Sep 2007
Posts: 4
ok now i want to make a function to be called when the DLL is unloaded



You can also define an UnloadDll() routine in your DLL which mIRC will call when unloading a DLL to allow it to clean up.

int __stdcall (*UnloadDll)(int mTimeout);




now how can i make a new funcion and make it the unload function?


Link Copied to Clipboard