• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

mfc dll doesn't register (I'm new at this)

Hi there I'm writing an mfc dll but can't get it to self register:

I -did- make a call to  AFX_MANAGE_STATE(AfxGetStaticModuleState()) at the
top of DllRegisterServer, but heck if I know what's going on.  By the way,
can anybody suggest a good book to get me jumpstarted?


Here's regsvr32's output:

blahblah.dll was loaded, but the DllRegisterServer entry point was not
found.

DllRegisterServer may not be exported, or a corrupt version of blahblah.dll
may be in memory.  ......


Thanks!

Ron
0
ronaldyang
Asked:
ronaldyang
  • 3
  • 3
1 Solution
 
Tommy HuiCommented:
The short answer is that your DLL does not have the function DLLRegisterServer function.

Note that this function is available only for DLLs whose purpose is to be an OLE server. If your DLL isn't an OLE server, then this isn't needed.

If you do indeed have this function, make sure the function is defined as

STDAPI DllRegisterServer(void)
{
}

You also need to have in the EXPORTS section of the .def file

EXPORTS
  DllRegisterServer


0
 
ronaldyangAuthor Commented:
Although I didn't bother with a .def file, I did include this in my class definition:

class AFX_EXT_CLASS mything : blahblah

Shouldn't that work?


0
 
Tommy HuiCommented:
No, that does not work for your DLLRegisterServer function. You need to have it in the .DEF file or provide __declspec(dllexport) in the definition of the DLLRegisterServer function.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
ronaldyangAuthor Commented:
> __declspec(dllexport) in the definition of the DLLRegisterServer function.

That caused a compiler warning.

STDAPI __declspec(dllexport) DllRegisterServer(void) results in a compiler warning.

0
 
Tommy HuiCommented:
If you're using STDAPI, do NOT use __declspec(dllexport), but you will need to use a .DEF file.
0
 
ronaldyangAuthor Commented:
Thank you!  Great point.

What books do you think could help me learn more?

thanks again,
Ron
0
 
Ronald BusterCommented:
I have the same problem, with a dll developed in delphi. However I don't use ole automation etc. I only use some variance calc's in the dll.

who can help me out on this one.

regards,

Cono
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now