Solved

DLL error

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

Want to promote your upcoming event?

Are you going to an event? Are you going to be exhibiting at a tradeshow? Talking at a conference? Using a promotional banner in your email signature ensures that your organization’s most important contacts stay in the know and can potentially spread the word about the event.

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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 how to create, access, and change arrays in the C programming language.

911 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now