I'm sorry i didnt explain it enough heres a very simple example
class Foo { public: Foo(){} ~Foo(){} // Does this have to be virtual for DLL's? // Must be virtual so function addresses are resolved at run time virtual void Bar(){} }; extern "C" __declspec(dllexport) Foo *newFoo(){ return new Foo; } do i need to make a extern "C" __declspec(dllexport) void deleteFoo( Foo *ptr ){ delete ptr; } ? so the code would look something like // ... Resolve function pointer from library handle Foo *Bar = pNewFoo(); // pNewFoo = GetProcAddress( myLib, "newFoo" ); do i have to go pDeleteFoo( Bar ); or can i just go delete Bar; ? ----- Original Message ----- From: "Polymorph" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 22, 2003 2:04 PM Subject: Re: [hlcoders] OT: Dlls and C++ > At 13:34 22.01.03 -0500, you wrote: > >This is a multi-part message in MIME format. > >-- > >[ Picked text/plain from multipart/alternative ] > >Ive been working on using C++ in external dlls that are later loaded at > >runtime; and i have a question: While i need a function to "new" a class, > >do i need one for "delete" or can i just call delete ptr; like normal? > > > >Josh > > Well... you don't need a function for that. > > For Example: > > [code] > // allocate class > pFoo = new CFoo; > > // and later to release it > delete pFoo; > [/code] > > This should usually work. On creation the constructor of the class gets > called. When you release an object by "delete" the destructor ought to be > called. > > Maybe I'm just missing point, but if I get you right then, this ought to work. > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders