Link to home
Start Free TrialLog in
Avatar of ronaldyang
ronaldyang

asked on

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
Avatar of Tommy Hui
Tommy Hui

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


Avatar of ronaldyang

ASKER

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?


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.
> __declspec(dllexport) in the definition of the DLLRegisterServer function.

That caused a compiler warning.

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

ASKER CERTIFIED SOLUTION
Avatar of Tommy Hui
Tommy Hui

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you!  Great point.

What books do you think could help me learn more?

thanks again,
Ron
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