Reply To: need example of calling user written dll

Product Compare Forums Multi-Edit Support need example of calling user written dll Reply To: need example of calling user written dll

#3725
Michal Vodicka
Participant

Pop up error messages from DLL is generally very bad idea. Instead, you should properly handle error conditions (i.e. don’t crash and don’t leak resources) and return appropriate error code to caller. It is up to caller to decide what to do with error code. Usually, only top layer knows if and how to inform user about a problem. Proper error handling isn’t quite easy and sometimes it can consume 50% and more code.

An example how to convert error code to appropriate message is in Platform SDK or VC++ docs, see FormatMessage docs. SDK also contains some DLL samples.

DllMain is optional and well documented. If there isn’t nothing to do on process or thread attach/detach, you can omit it. If you want to place any initialization there, read docs carefully because there are some important limitations.