Thread: _declspec behavior

  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    _declspec behavior

    Looking at this from MSDN:

    To export all of the public data members and member functions in a class, the keyword must appear to the left of the class name as follows:

    Code:
    Copyclass __declspec(dllexport) CExampleExport : public CObject
    { ... class definition ... };
    One would think you could have a private std::string and be ok. However the compiler will warn you that clients of your class need a dll interface to access your variable. Now if the export only exports public data members and member functions (public member functions?) why does it give this warning if your private data member is not actually being exported?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Both sides of the fence need to agree on sizeof(CExampleExport) for example, so both sides need know what makes a "CExampleExport", even if some of those data members are not exposed publicly.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange string behavior
    By jcafaro10 in forum C Programming
    Replies: 2
    Last Post: 04-07-2009, 07:38 PM
  2. Normal iterator pointer behavior
    By SevenThunders in forum C++ Programming
    Replies: 9
    Last Post: 04-01-2008, 12:11 PM
  3. C++ list Strange Behavior
    By yongzai in forum C++ Programming
    Replies: 19
    Last Post: 12-29-2006, 02:56 AM
  4. strange behavior
    By agarwaga in forum C Programming
    Replies: 1
    Last Post: 10-17-2005, 12:03 PM
  5. Game Design Topic #1 - AI Behavior
    By TechWins in forum Game Programming
    Replies: 13
    Last Post: 10-11-2002, 10:35 AM