Insolence Posted January 3, 2005 Posted January 3, 2005 [Kind of OT] Do any of you C++ worn old folk have a link to on specifically on the creation of DLL's and anything else that would be important to that. [/OT] Here's the source: #include <windows.h> __declspec(dllexport) int Hello(); int Hello(){ MessageBox( NULL, "Hello world!", NULL, MB_OK ); return 1; } Here's the AutoIT file: $test = DllCall( @ScriptDir & "\Project1.dll", "int", "Hello" ) MsgBox("","", $Test) It should throw the "Hello world!" message box, and then throw the successfully returned value "1". Obviously, it's not. As with my last DLL post I feel ashamed, please don't bash me... or if you have to, be gentle "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Insolence Posted January 3, 2005 Author Posted January 3, 2005 Thanks. I didn't really understand most of that, I got rid of as much of the DLL as I could, it's just one file... that's all the code. I thought I should post it there, but I think people need to see it here also. I'm playing SC right now, but I'll do the $Test[0] thing, thanks. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Insolence Posted January 3, 2005 Author Posted January 3, 2005 I get C:\Documents and Settings\Eric\Desktop\programming\cpp\memory reader\test.au3 (3) : ==> Subscript used with non-Array variable.: now, so I assume it's just not returning a single thing. eh "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Valik Posted January 3, 2005 Posted January 3, 2005 The name for that is mangled via the C++ compiler. It needs to be extern "C" in order to have the correct name. This should work. #include <windows.h> extern "C" __declspec(dllexport) int Hello(){ MessageBox( NULL, "Hello world!", NULL, MB_OK ); return 1; } Or, as Larry mentioned, you need a module definition file and then you can do without the 'extern "C" __declspec(dllexport)' stuff.
Insolence Posted January 3, 2005 Author Posted January 3, 2005 (edited) I'm at school now but I'll test that when I get home, thanks EDIT- Excellent! It works, time to get to work. Edited January 3, 2005 by Insolence "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now