A conceptual question on using DLL'd

This is a discussion on A conceptual question on using DLL'd within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I have been started using dll's with classes, and I have find that there's two ways to use them ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287

    A conceptual question on using DLL'd

    Hello, I have been started using dll's with classes, and I have find that there's two ways to use them (I don't know if there's more that two); the first is a simple call from the main program like that:

    Code:
    CTest A;
    printf("%d",A.someFunction());
    }
    seems like a call to a struct variable. It works well, althought the 'someFunction()' only returns an int value. But I tryed to do it by the habitual way of working with classes and also works well, seems like there's no difference on the results; that second method I call a constructor and a destructor for the class, something like:

    Code:
    CTest* A;
    A=new CTest();
    printf("%d",A->someFunction());
    delete A;
    of course in that second way I have declared the constructor and destructor in the dll class, but I have to modify it a bit: if I declare it as:

    Code:
    virtual ~CTest();
    it makes a big error on the call to the 'delete A', but if I declare it as non_virtual (simply '~CTest();') there's no error, and works fine.

    And that's my question: both methods (the first without constructor/destructor and the last with constructor/non_virtual_destructor) are valid ways to use classes with dll's?

    Thank's in advance
    Niara

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    (hello, a little error on the question title, at the end please read "dll's" instead "dll'd")
    Niara

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 06:51 PM
  2. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 01:52 PM
  3. disjoint sets conceptual question
    By axon in forum C++ Programming
    Replies: 1
    Last Post: 03-01-2004, 10:49 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM

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