• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 251
  • 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

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


  • 3
  • 3
1 Solution
Tommy HuiEngineerCommented:
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


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?

Tommy HuiEngineerCommented:
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.
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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.

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

What books do you think could help me learn more?

thanks again,
Ronald BusterOwnerCommented:
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.


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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