DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    kenny Guest

    use of DLL : put an entire class in the dll source ? possible ?


    hi,
    i d like to put an entire class in a dll (an MFC extended one)

    But there are some member variables in this one..
    Shall i put them outside in application code and pass them by reference
    (in this case ...what can i do for constructors and destructor ) ?
    or
    Can I really put the entire class in the library ? (I ve read it somewhere
    but found it that weird because I ve not understood how handling of variables
    was managed : writing of variables to be read ans vice&versa). So if it is
    possible.. How can I do it as far as application and dll code are concerned
    ?

  2. #2
    Ralph Guest

    Re: use of DLL : put an entire class in the dll source ? possible ?


    "kenny" <javatoto@yahoo.fr> wrote:
    >
    >hi,
    >i d like to put an entire class in a dll (an MFC extended one)
    >
    >But there are some member variables in this one..
    >Shall i put them outside in application code and pass them by reference
    >(in this case ...what can i do for constructors and destructor ) ?
    >or
    >Can I really put the entire class in the library ? (I ve read it somewhere
    >but found it that weird because I ve not understood how handling of variables
    >was managed : writing of variables to be read ans vice&versa). So if it

    is
    >possible.. How can I do it as far as application and dll code are concerned
    >?


    Yes, you can place an entire 'class' in a MFC Extension DLL and use it just
    as you would if it was statically compiled within your application. It can
    be a very useful method to share common code between a suite of MFC applications.
    (Your only other options are 'regular' DLLs, which would only allow you to
    export 'C' style functions, or an ActiveX component.)

    (However, be aware of a MFC Extension DLL limitations; it can only be used
    with other MFC applications that are dynamically linked to the MFC libraries,
    you have to make sure you handle dynamic loading/unloading, and use the AFX_EXT_CLASS
    macro in your class definition to insure everything gets exported correctly.)

    As to "member variables" are you referring to 'public' variables? (While
    one might question the design...<smile>) you can reference them the same
    as you would any class members.



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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links