3.6
Frequently Asked Questions ,
The implementation of these functions in the DLL would look like this:
CCommBase* CElnApi::Factory(...) // Static function
{
CCommBase* pDriver = new CElnApi(...);
Return pDriver;
}
void CElnApi::Destroy()
{
delete this;
}
Note: The Destroy function looks dangerous due to its self-destructive nature, but this is actually standard
practice. Just don't try to access any member data after calling delete this.
Anyway, all of this complication can be neatly avoided by making the driver a statically linked library.
Since the drivers are small, there's really no good reason to fight these battles.
8/99
continued
RS232 Communications Reference Manual
PC Communication Driver
25