Jump to content

A Beginner needs help


Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...