Solved

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

Posted on 1998-07-23
7
246 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 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