Solved

DLL error

Posted on 1998-10-09
1
188 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

770 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