http://qs321.pair.com?node_id=656695


in reply to functions with optional arguments in Windows DLLs

As BrowserUK suggests, C doesn't have Optional arguments. However C++ does (with some constraints). In essence the C++ compiler takes care of it for you by providing the default value at call time if you haven't provided a value yourself. C++ also provides function overloading where different functions with the same name (but different prototypes) may be used. If you are really dealing with sparsely documented C++ then you are in a world of pain.

Actually, if it is C++ then the situation is even worse because C++ mangles identifiers. The identifier the linker sees is not the identifier that was compiled, and there are no rules for how that mangling is done.

Arguments that are notionally optional in C generally accept a 0 (NULL) if they are not being provided. Most often such arguments are pointers so you are simply passing a null pointer to the function.


Perl is environmentally friendly - it saves trees
  • Comment on Re: functions with optional arguments in Windows DLLs