Exporting Class methods to a DLL

This is a discussion on Exporting Class methods to a DLL within the Windows Programming forums, part of the Platform Specific Boards category; Having looked at petzolds book and the msdn section on DLLs, I still cannot figure out the proper way on ...

  1. #1
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790

    Exporting Class methods to a DLL

    Having looked at petzolds book and the msdn section on DLLs, I still cannot figure out the proper way on exporting methods. I know that you include __declspec(dllexport) after "class" but before the class name, however, do I need to do the same when I define my functions individually?

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    for various reasons that are explained in chapter 1 of any COM book, I don't ever export classes. What I usually do is create an exported C function:

    IStandard *GetNewObject(char *name, int version);

    where IStandard is a class with only pure virtual functions

    AddRef()
    ReleaseRef()
    QueryInterface()

    QueryInterface returns a pointer to a particular base class with more specific methods.

    This probably makes no sense to you but hey, that's what I do anyway.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    any good COM books out their to read?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. global and static variable in a class delivered in a DLL
    By George2 in forum C++ Programming
    Replies: 16
    Last Post: 04-13-2008, 09:19 AM
  2. Class methods in header or source file?
    By TriKri in forum C++ Programming
    Replies: 13
    Last Post: 09-17-2007, 06:23 AM
  3. Class communication methods
    By cboard_member in forum Game Programming
    Replies: 2
    Last Post: 02-23-2006, 12:25 PM
  4. exporting class methods to library results in .lib and .exp
    By Shadow12345 in forum C++ Programming
    Replies: 15
    Last Post: 01-05-2003, 08:01 PM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 02:30 PM

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