Solved

DLL error

Posted on 1998-10-09
1
189 Views
Last Modified: 2010-04-15
(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
Comment
Question by:totoro030898
1 Comment
 
LVL 8

Accepted Solution

by:
Answers2000 earned 90 total points
ID: 1253452
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Macro will not compile after project converted from IAR to Microchip xc8 (in MPLab) 3 191
Problem to ASCII 1 197
Global Keyboard Hooks Blocked 4 81
Resolve Dependency Issues 4 79
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question