cards.dll

This is a discussion on cards.dll within the Windows Programming forums, part of the Platform Specific Boards category; I am trying to write a simple (test before I make a complicated) app that takes text as input and ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    170

    cards.dll

    I am trying to write a simple (test before I make a complicated) app that takes text as input and draws the card given.

    AS draws the ace of spades.
    2H draws 2 of hearts.

    I found a how to here: http://freespace.virgin.net/james.br...ts/cardtut.htm

    I am getting errors.

    Here is my code:

    Showcarddlg.h
    Code:
    HMODULE hCardDll;
    
    BOOL InitCardsDll(void);
    
    void *cdtInit;
    void *cdtDraw;
    void *cdtDrawEx;
    void *cdtTerm;
    
    typedef BOOL (WINAPI *pfcdtInit)(int *, int *);
    typedef BOOL (WINAPI *pfcdtDraw)(HDC, int x, int y, int card, int type, DWORD color);
    typedef BOOL (WINAPI *pfcdtDrawEx)(HDC, int x, int y, int dx, int dy, int card, int type, DWORD color);
    typedef BOOL (WINAPI *pfcdtAnimate)(HDC hdc, int cardback, int x, int y, int state);
    typedef void (WINAPI *pfcdtTerm) (void);
    ShowcardDlg.cpp
    Code:
    BOOL InitCardsDll(void)
    {
        hCardDll = LoadLibrary("cards.dll");
    
        if(hCardDll == 0)
            return FALSE;
            
        cdtInit   = (pfcdtInit)   GetProcAddress(hCardDll, "cdtInit");
        cdtDraw   = (pfcdtDraw)   GetProcAddress(hCardDll, "cdtDraw");
        cdtDrawEx = (pfcdtDrawEx) GetProcAddress(hCardDll, "cdtDrawExt");
        cdtTerm   = (pfcdtTerm)   GetProcAddress(hCardDll, "cdtTerm");
        
        return TRUE;
    }
    I call InitCards() in OnInitDialog()

    here are the errors I am getting:
    showcardDlg.obj : error LNK2005: "struct HINSTANCE__ * hCardDll" (?hCardDll@@3PAUHINSTANCE__@@A) already defined in showcard.obj
    showcardDlg.obj : error LNK2005: "void * cdtInit" (?cdtInit@@3PAXA) already defined in showcard.obj
    showcardDlg.obj : error LNK2005: "void * cdtDraw" (?cdtDraw@@3PAXA) already defined in showcard.obj
    showcardDlg.obj : error LNK2005: "void * cdtDrawEx" (?cdtDrawEx@@3PAXA) already defined in showcard.obj
    showcardDlg.obj : error LNK2005: "void * cdtTerm" (?cdtTerm@@3PAXA) already defined in showcard.obj

    Any help you could provide would be great.

    Edit: I think I figured it out. Looks like I have to move my definitions out of the header file. Because the header file is being picked up my multiple .cpp files. Since these defs are global it is trying to load multiples.
    Last edited by bonkey; 10-29-2002 at 08:26 AM.
    Best Regards,

    Bonkey

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cards.dll and evil blue screens
    By ... in forum Windows Programming
    Replies: 10
    Last Post: 10-16-2003, 09:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21