Re: explicit extension DLL wreaking havok during AfxFreeLibrary

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 07/07/04


Date: Wed, 07 Jul 2004 12:42:55 -0400

Well, this is a bit odd. For one thing, there IS no "runtime class table"; the
RUNTIME_CLASS macro actually reaches into the class's private storage area to get the
information. So there isn't any one place that can be damaged that can cause this (go read
the RUNTIME_CLASS macro in afx.h: it is one line of code that returns the address
        
#define RUNTIME_CLASS(class_name) ((CRuntimeClass *)(&class_name::class##class_name))

so there is no way this simple macro could be made to fail after the AfxFreeLibrary.

Defining "fail" would help, of course. Wrong value? Access fault? Can you show an example
of the failing code?
                                        joe

On Tue, 6 Jul 2004 17:17:13 -0400, "Doug" <nospam@nospam.com> wrote:

>For some reason, my extension dll -- which is explicitly loaded by my main
>application -- frees up my entire application's runtime class table (!?) if
>I call AfxFreeLibrary to close it. The very next attempt by my application
>after freeing the DLL to get CRuntimeClass info by name of ANY of my main
>application's classes will fail.
>
>Whats up? Should we not free extension dlls that are explicitly linked?
>The DLL loads and works fine.
>
>Any insight would be greatly appreciated!
>
>btw, my extension dll project defines _AFXEXT and my main MFC app defines
>_AFXDLL.
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: Import/Export Multiple Excel Files to Access
    ... "Ken Snell (MVP)" wrote: ... Dim strPathFile As String, strFile As String, strPath As String ... Create a new macro, and name it ...
    (microsoft.public.access.macros)
  • Re: Forms vs SpellCheck
    ... MVP site works. ... The macro still works. ... because the text fields get set back to not spell check and it does not ... the form to protect/unprotect? ...
    (microsoft.public.word.spelling.grammar)
  • Re: Import/Export Multiple Excel Files to Access
    ... "Ken Snell (MVP)" wrote: ... Dim strPathFile As String, strFile As String, strPath As String ... Create a new macro, and name it ...
    (microsoft.public.access.macros)
  • Re: UserForm/MailMerge
    ... see the "Individual Merge Letters" item on fellow MVP Graham Mayor's ... if you run the following macro when the mail merge main ... Dim dSource As String ... 'Get the details of the datasource ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Malmacros
    ... there is not any malicious code on ... the MVP site and all code there is tested. ... This message is posted to a newsgroup. ... > I've got a rough idea that if I inspect a macro before running it and I ...
    (microsoft.public.word.vba.general)