简体   繁体   中英

no entry point found in windows dll while using regsvr32

I'm trying to create a DLL in Visual C++ express 2008. My DLL proyect compiles fine and the *.dll is created. However, when I try to register it with regsvr32 I get the following error message:

"The name.dll module was loaded, but the entry ponint was not found, DllUnregisterServer" (the message goes something like that, I'm translating it from my spanish version of Windows).

I'm using Windows 7 64 bit OS But I think the *.dll is created in 32 bit because of my version of Visual C++ Express...

Her is the code:

DLL.h

#ifndef DLLHEADER_H_INCLUDED
#define DLLHEADER_H_INCLUDED

#ifdef DLL_EXPORTS
 #define DLL_API __declspec(dllexport)
#else
 #define DLL_API __declspec(dllimport)
#endif

extern "C"
{
 struct DLL_API Datos
 {
  char cad1[100];
  char cad2[100];
  char cad3[100];
 };

 DLL_API void __stdcall funcion(char*);
 DLL_API void __stdcall saludo(void);
}

#endif

DLL.cpp

#include "stdafx.h"
#include "DLL.h"

void __stdcall funcion(char* ptr)
{
 Datos* d = (Datos*)ptr;

 std::cout<<"DESDE LA DLL : \n";
 std::cout<<"Cadena1 : "<<d->cad1<<'\n';
 std::cout<<"Cadena1 : "<<d->cad2<<'\n';
 std::cout<<"Cadena1 : "<<d->cad3<<'\n';
}

void _stdcall saludo(void)
{
 std::cout<<"Hola desde DLL.\n";
}

I created the proyect following a MSDN tutorial and the template also adds this file:

dllmain.cpp

// dllmain.cpp : Define el 'entry point' para la aplicación DLL.
#include "stdafx.h"

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
 switch (ul_reason_for_call)
 {
  case DLL_PROCESS_ATTACH :
  case DLL_THREAD_ATTACH  :
  case DLL_THREAD_DETACH  :
  case DLL_PROCESS_DETACH :
                           break;
 }

 return TRUE;
}

As fas as I understand, everything is fine, but apparently I can't register the *.dll.

Is something missing?

Thanks for your help.

regsvr32 is only used with ActiveX/COM servers. Your DLL is not a COM server, so there is no point in calling regsvr32 for your DLL in the first place, as there is nothing to register/unregister.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM