Solved

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

Posted on 1998-07-23
7
244 Views
Last Modified: 2013-12-04
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
Comment
Question by:ronaldyang
[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
  • 3
  • 3
7 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1410873
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
 

Author Comment

by:ronaldyang
ID: 1410874
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
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1410875
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:ronaldyang
ID: 1410876
> __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
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 1410877
If you're using STDAPI, do NOT use __declspec(dllexport), but you will need to use a .DEF file.
0
 

Author Comment

by:ronaldyang
ID: 1410878
Thank you!  Great point.

What books do you think could help me learn more?

thanks again,
Ron
0
 
LVL 3

Expert Comment

by:Ronald Buster
ID: 1410879
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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