One strange thing took my sleep away. .
I have P7 library. It is library for writing logs.
Library contains few examples. Example for C++ looks like:
int main(int i_iArgC, char* i_pArgV[])
{
// Some code that don't use i_iArgC or i_pArgV
}
But the trick that program handle command line arguments somehow.
I play a little bit to make sure that this main called.
What I do:
- Build in debug and set breakpoint on
main
(to make sure that exactly thismain
is called) - Change
main(int i_iArgC, char* i_pArgV[])
tomain()
(To make sure that no one use them)
I have no idea how it possible.
Here is minimal steps you can do to look on it by yourself:
- Download P7 code from this page (link at top left)
- Unzip archive
- Run build.sh (It runs few makefiles in some order)
- Execute
Cpp_Example
fromBinaries
folder - Execute again
Cpp_Example /P7.Help
to see that app react to command line arguments.