Professional Web Applications Themes

Newbie to mac, what is the sharedlib version of MFC DLL exitinstance? - Mac Programming

Hi all, new to mac and suffering the usual , where to look, guess what functions might be called syndrome... When a mac shared lib is unloaded is there some function that is called where I can add cleanup code? Thanks in advance Gary...

  1. #1

    Default Newbie to mac, what is the sharedlib version of MFC DLL exitinstance?

    Hi all,

    new to mac and suffering the usual , where to look, guess what functions
    might be called syndrome...

    When a mac shared lib is unloaded is there some function that is called
    where I can add cleanup code?

    Thanks in advance

    Gary

    Gary Guest

  2. #2

    Default Re: Newbie to mac, what is the sharedlib version of MFC DLLexitinstance?

    dans l'article caoudp$gri$btinternet.com, Gary Fozzard à
    com a écrit le 16/06/04 9:55:
     

    If it's a MachO plugin, I don't know.
    If it's a CFM plugin, here's a sample:

    short gDllResFile = 0;
    uchar gDllName[256];

    extern "C" {

    // thes are in CW runtime libs
    pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
    pascal OSErr __terminate();
    // these are yours
    pascal OSErr PluginInit(const CFragInitBlock* theInitBlock);
    pascal void PluginExit();

    }

    pascal OSErr PluginInit(const CFragInitBlock* theInitBlock)
    {
    OSErr err;

    err = noErr;

    __initialize(theInitBlock);

    if (theInitBlock->fragLocator.where == kDataForkCFragLocator)
    {
    gDllResFile =
    ::FSpOpenResFile(theInitBlock->fragLocator.u.onDisk.fileSpec, fsRdPerm);
    if (gDllResFile == -1)
    err = ResError();
    }

    if (theInitBlock->libName != nil)
    ::BlockMoveData(gDllName,
    theInitBlock->fragLocator.u.onDisk.fileSpec->name,theInitBlock->fragLocator.
    u.onDisk.fileSpec->name[0] + 1);


    return err;
    }

    pascal void PluginExit(void)
    {
    if (gDllResFile && gDllResFile != -1)
    ::CloseResFile(gDllResFile);

    __terminate();
    }

    In your CW project, you need to set the entry points in the linker panel.

    Eric

    Eric Guest

  3. #3

    Default Re: Newbie to mac, what is the sharedlib version of MFC DLL exitinstance?

    Eric thanks, its written in CW9 and is a carbonised lib
    libraries used are carbonlib and MSL_All_Carbon_D.

    Gary

    Eric VERGNAUD wrote: 
    >
    >
    > If it's a MachO plugin, I don't know.
    > If it's a CFM plugin, here's a sample:
    >
    > short gDllResFile = 0;
    > uchar gDllName[256];
    >
    > extern "C" {
    >
    > // thes are in CW runtime libs
    > pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
    > pascal OSErr __terminate();
    > // these are yours
    > pascal OSErr PluginInit(const CFragInitBlock* theInitBlock);
    > pascal void PluginExit();
    >
    > }
    >
    > pascal OSErr PluginInit(const CFragInitBlock* theInitBlock)
    > {
    > OSErr err;
    >
    > err = noErr;
    >
    > __initialize(theInitBlock);
    >
    > if (theInitBlock->fragLocator.where == kDataForkCFragLocator)
    > {
    > gDllResFile =
    > ::FSpOpenResFile(theInitBlock->fragLocator.u.onDisk.fileSpec, fsRdPerm);
    > if (gDllResFile == -1)
    > err = ResError();
    > }
    >
    > if (theInitBlock->libName != nil)
    > ::BlockMoveData(gDllName,
    > theInitBlock->fragLocator.u.onDisk.fileSpec->name,theInitBlock->fragLocator.
    > u.onDisk.fileSpec->name[0] + 1);
    >
    >
    > return err;
    > }
    >
    > pascal void PluginExit(void)
    > {
    > if (gDllResFile && gDllResFile != -1)
    > ::CloseResFile(gDllResFile);
    >
    > __terminate();
    > }
    >
    > In your CW project, you need to set the entry points in the linker panel.
    >
    > Eric
    >[/ref]

    Gary Guest

Similar Threads

  1. [Newbie] Need help creating Mac version CD
    By Marilyn in forum Macromedia Director Basics
    Replies: 2
    Last Post: September 23rd, 09:15 AM
  2. Replies: 4
    Last Post: July 19th, 05:32 AM
  3. Replies: 2
    Last Post: October 2nd, 12:17 PM
  4. Replies: 0
    Last Post: September 22nd, 05:27 PM
  5. Replies: 0
    Last Post: July 4th, 11:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139