Skip to main content
gamedev.net
🔒 Locked

Making DLL's with Dev-C++

Started by Monder Jan 11, 2003 at 2:48 PM 0 replies 650+ views
Original Post
Monder
Monder
Ok I've got Dev-C++ version 4.9.6.0 and I'm trying to create a dll. I start a new DLL project and it gives you some example sourcecode however this sourcecode does not compile. I get this error output dlltool: Unable to open object file: DLL.dll dllwrap.exe: no export definition file provided dllwrap.exe: creating one, but that may not be what you want dllwrap.exe: dlltool exited with status 1 make.exe: *** ["My] Error 1 And here's the source for the dll I'm trying to compile(it's the sameple one that comes with dev-c++) dllmain.c
      
/* Replace "dll.h" with the name of your header */
#include "dll.h"
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>


DLLIMPORT void
HelloWorld ()
{
    MessageBox (0, "Hello World from DLL!\n", "Hi", MB_ICONINFORMATION);
}


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;
}
  
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 */


DLLIMPORT void HelloWorld (void);


#endif /* _DLL_H_ */
  
Anyone know what's going wrong? [edited by - Monder on January 11, 2003 3:50:17 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.