blahblahblah5038 Posted July 26, 2007 Share Posted July 26, 2007 I wanted to learn how to use C++ dll files in auto it for a larger program I am working on, so I made a simple program in auto it, and a simple c++ dll just to try and learn. I think of it as my version of the hello world program. The idea is that the math that the dll does should match the math that auto it does. Problem is that they don't, the dll always returns 0. I need help. Here is the code for the auto it program and the c++ dll as well as the compiled dll CODE ; auto it for $count1 = 1 to 10 for $count2= 1 to 10 $close = DllOpen("dll test.dll") $A = DllCall ("dll test.dll", "int", "addTEST", "int", $count1, "int", $count2) $B = DllCall ("dll test.dll", "int", "multTEST", "int", $count1, "int", $count2) $C = $count1 +$count2 $D = $count1 *$count2 MsgBox (0, "Addition Test", "Internal math " & $count1 & "+" &$count2 & "=" &$C) MsgBox (0, "Addition Test", "Dll math " & $count1 & "+" &$count2 & "=" &$A) MsgBox (0, "Multiplication Test", "Internal math " & $count1 & "*" &$count2 & "=" &$D) MsgBox (0, "Multiplication Test", "Dll math " & $count1 & "*" &$count2 & "=" &$ DllClose ($close) Next Next CODE// dll test.cpp : Defines the entry point for the DLL application. // //c++ dll #ifdef _MANAGED #pragma managed(push, off) #endif int addTEST (int A, int Bb); int multTEST (int A, int Bb); BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } #ifdef _MANAGED #pragma managed(pop) #endif int addTEST (int A, int Bb) { int nReturn; nReturn = A + Bb ; return nReturn; } int multTEST (int A, int Bb) { int nReturn; nReturn = A*Bb; return nReturn; }dll_test.dll Noteworthy works:Fast Pixel SearchSigned: WG Link to comment Share on other sites More sharing options...
blahblahblah5038 Posted July 30, 2007 Author Share Posted July 30, 2007 Any help would be most appreciated. Noteworthy works:Fast Pixel SearchSigned: WG Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 30, 2007 Share Posted July 30, 2007 First of all, DllCall returns an array, not just the return value. Also, I checked your dll itself, you don't have any functions exported. I'm afraid I don't know how to do that because every time I tried to do so, it didn't work. Link to comment Share on other sites More sharing options...
blahblahblah5038 Posted July 31, 2007 Author Share Posted July 31, 2007 Thankyou, I think I'll look into those Noteworthy works:Fast Pixel SearchSigned: WG Link to comment Share on other sites More sharing options...
blahblahblah5038 Posted August 3, 2007 Author Share Posted August 3, 2007 I solved the problems, got the dll to work, and then implemented the changes on the larger program I was working on for an ultra fast pixel search. Thanks again. Noteworthy works:Fast Pixel SearchSigned: WG Link to comment Share on other sites More sharing options...
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