Jump to content

first Dll compiled ok


layer
 Share

Recommended Posts

i made my first dll and it compiled fine, no errors, i got the dll, and when i test it, like so, it doesnt work o:)

Dllmain.cpp:

/* Replace "dll.h" with the name of your header */
#include "dll.h"
#include <windows.h>

DllClass::DllClass()
{

}


DllClass::~DllClass ()
{

}


BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
                       DWORD reason        /* Reason this function is being called. */ ,
                       LPVOID reserved     /* Not used. */ )
{
    switch (reason)
    {
      case DLL_PROCESS_ATTACH:
        break;

      case DLL_PROCESS_DETACH:
        break;

      case DLL_THREAD_ATTACH:
        break;

      case DLL_THREAD_DETACH:
        break;
    }

    /* Returns TRUE on success, FALSE on failure */
    return TRUE;
}

__declspec(dllexport) int Add (int a, int b)
{
                      return(a + b);
}

Dll.h:

#ifndef _DLL_H_
#define _DLL_H_

#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */


class DLLIMPORT DllClass
{
  public:
    DllClass();
    virtual ~DllClass(void);

  private:

};


#endif /* _DLL_H_ */

AutoIt DllCall test:

$add= DllCall ("Add.dll", "int", "Add", "int", 1, "int", 2)
MsgBox (4096, "Testing Add.dll", $add)
;Even tried:
$add= DllCall ("Add.dll", "int", "Add", "int", 1, "int", 2)
MsgBox (4096, "Testing Add.dll", $add[0])

could someone please assist me on this, i know it's probably all wrong and everything, even though it is very basic and simple.. pleASE?!

! :lmao::)

thanks..

EDIT: almost forgot, the Dll file itself... and also, i compiled it with Dev-C++ 4.9.9.1..

Edited by layer
FootbaG
Link to comment
Share on other sites

:):):lmao:o:) yayayayayaya my first Dll! thanks a million josbe :whistle::huh2:!!! well,better go post this sucker in the Scripts n' Scrapts (even if it is like reallllllly simple, its my first Dll, and im poroud)

and

about the this isnt a support forum, i just thought i'd ask here because it was for C++ but next time ill post in the support section :P and thanks a million a million times josbe :)!!

FootbaG
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...