mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
New to C++ 2005 Express.
Having some issues creating a mIRC DLL in it.

I would really like it if someone could create a "Hello world" dll in:

Visual C++ 2005 Express Edition.

Just a simple way to return 'Hello World'

Perhaps a DLLinfo section containing the Authors info.
Thanks,
JD.

Looking around, I have not seen any information about VC++2k5E mirc dll's.


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
and please .zip the full project... not just the main file... I need to be able to compile it smile

Thanks again,
JD.


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
My ruby4mirc DLL (located at http://kthx.net/ruby4mirc) compiles in VS.NET 2005. Source code is available there that you can use as a reference.

Keep in mind that the Express version of VS is missing many SDK's and toolkits needed to properly compile a lot of applications, though it should be able to compile a minimal DLL just fine

You may want to elaborate on your problem though-- are you having trouble compiling, or running the DLL in mIRC? You have to make sure your symbols are propertly exported, if you were able to compile.

Generally, a minimal dll source file hello.c looks like:

Code:
#include <windows.h>

int __declspec(dllexport) __stdcall helloWorld(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)
{
  strcpy(data, "Hello world");
  return 3;
}


With a hello.def file (for the exports)

Code:
LIBRARY hello
EXPORTS
helloWorld


And would be used in mirc as:

Code:
//echo -a $dll(hello.dll,helloWorld,$null)




- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Wow, Thanks for the quick reply...


Ill check it out now, and let you know how I go ASAP.

The truth: The problem im having is i'm a C++ noob.
Lies: Something went wrong.

Lol, I've only create com dll's in VB6 for mIRC.

I'm working on it.


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
If i include the include for windows.h it tells me it is not found.
otherwise, i get this:

c:\documents and settings\jd\desktop\mircdll\hello.c(3) : error C2146: syntax error : missing ')' before identifier 'mWnd'
c:\documents and settings\jd\desktop\mircdll\hello.c(3) : error C2061: syntax error : identifier 'mWnd'
c:\documents and settings\jd\desktop\mircdll\hello.c(3) : error C2059: syntax error : ';'
c:\documents and settings\jd\desktop\mircdll\hello.c(3) : error C2059: syntax error : ','
c:\documents and settings\jd\desktop\mircdll\hello.c(3) : error C2059: syntax error : ')'


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
If you're missing windows.h it's likely because VS.net Express 2005 doesn't include the windows SDK's required to compiled windows applications, which is totally likely, because that's something you'd expect microsoft to do... give you free software that can do absolutely nothing with.

There are free alternatives to compiling dlls, like MingW and cygwin's gcc compiler. Try those.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You have to install the platform SDK separately. You can get it from the Microsoft website.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Note that in the case of this specific dll where you make no calls to the windows api, you don't actually need to #include <windows.h> if you didn't want to, you'd just have to replace the HWND with void * and BOOL with .. int?


But I don't recommend that at all, unless you just want to see if you're going to run into other problems beyond the windows.h thing.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Just testing off that

---
c:\documents and settings\jd\desktop\mircdll\hello.c(5) : warning C4013: 'strcpy' undefined; assuming extern returning int
---

Im guessing that requires the platform SDK as well?

Finally the DLL will actually compile, so I guess its a start.
All I want to do right now is return a string.

I'm not sure which platform SDK to download... I found the Win3kServerR2 PSDK but not sure if it's what i'm on as im on XP?

This help is really appreciated guys


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Looks like the "Microsoft ® Windows Server® 2003 R2 Platform SDK" is supported on XP, too (read the requirements!)

strcpy would be from the #include <string.h> and requires the libc.lib library (You should be able to find that out by highlighting "strcpy" in the IDE and pressing F1...although I find MS's helpfile to be more difficult to understand than necessary.) Not sure whether that is in the PSDK or not - I'm sure I've used it without any problems, but I didn't have too many difficulties installing the PSDK.

There are some instructions on installing the PSDK here ... (Isn't this getting a little OT? wink


Sais
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Ok, I installed the SDK, ran some batch files etc etc...
Didnt know I had to update stuff manually

But http://www.nuclex.org/articles/setting-up-visual-cxx-express was very helpful... All seems well right now, Ill let you know how this works.

Now I have access to windows.h, things should work better.


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Code:
------ Build started: Project: hello, Configuration: Debug Win32 ------
Compiling...
hello.c
Linking...
Embedding manifest...
Build log was saved at "file://c:\Documents and Settings\JD\Desktop\MircDLL\Debug\BuildLog.htm"
hello - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


Looks good, Right?
But now mIRC says: * $dll: no such routine 'helloWorld'


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Do you have the .def file in the project?


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Yep


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Mar 2006
Posts: 395
T
The_JD Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Thanks Guys - Finally have it all working...

Bigger thanks to Argv[0] (Hope i spelt that right) for help here and on #mIRC in EFnet.


[02:16] * Titanic has quit IRC (Excess Flood)

Link Copied to Clipboard