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:
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; printf("%d",A.someFunction()); }
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:CTest* A; A=new CTest(); printf("%d",A->someFunction()); delete A;
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.Code:virtual ~CTest();
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