Solved

DLL error

Posted on 1998-10-09
1
191 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

717 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