[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

DLL error

(Environment: VC++ 5.0, Win95)
Hi, I am creating a very simple Win32 DLL, which does nothing but only wait for my application to call the one and only exported function. I have no problem compiling it. However, when I try to Regsvr32 it, it gives the error :

LoadLibrary ("mydll.dll") failed
GetLastError returns 0x0000001f

When I try to access the exported function "START_HERE" (as listed below) in my VB5.0 code, it gives the error #48:File not found (mydll's name here).

I have copied my dll into the System directory. And there are no spelling mistakes.

This is the skeleton of my C code. Did I do anything wrong here?

START.C
--------
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <stdlib.h>

#ifndef DLLEXP
#define DLLEXP            __declspec(dllexport)
#endif //DLLEXP

#ifndef CALLSEQ
#define CALLSEQ            CALLBACK
#endif //CALLSEQ

void _setargv() {};
void _setenvp() {};

BOOL WINAPI DllMain (HANDLE hModule, DWORD fwdReason, LPVOID lpReserved)
{
      switch (fwdReason)
      {
      case DLL_PROCESS_ATTACH:
            break;
      
      case DLL_PROCESS_DETACH:
            break;
      }
      return TRUE;
}

DLLEXP int CALLSEQ START_HERE ( /*some parameters*/ )
{      
     /*blah blah blah*/
     return 0;
}

Thanks for your help.
Jun.
0
totoro030898
Asked:
totoro030898
1 Solution
 
Answers2000Commented:
You are getting confused about REGSVR32

You do NOT need to use it for a simple C DLL

REGSVR32 is normally used to register OCXs and ActiveX components into the Windows registry (COM components which may come in an "ActiveX DLL").  You don't need to use for a normal DLL.

Other C programs use your DLL by using LoadLibrary and GetProcAddress, or by linking to the .LIB file associated by your DLL.

Incidentally the REGSVR32 error occurs because your DLL doesn't fit the expectations of REVSVR32 for a COM component (your DLL isn't a COM component)
0

Featured Post

SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now