mingw32 DLL getting main args?
Daniel C. Sinclair
Mon Nov 1 04:16:00 GMT 1999
On Sun, 31 Oct 1999, Colin Peters wrote:
> The reason DLLs call getmainargs to parse the command line list
> is so that they can provide the MS-like _argc and _argv variables for
> access by functions within the DLL. Check init.c, which is #included
> (yuck) in dllcrt1.c. If you like you can remove the declarations from
> stdlib.h and work up a DLL version of init.c to remove the dependency
> of your DLL on the C run-time library. (I suspect this hasn't changed
> in Mumit's version, I must admit I only checked my source.)
Why support something that is non-standard? This is supposed to be a
minimalist Win32 compiler. Just because VC++ has _argc and _argv doesn't
mean everyone else has to. There are other ways to get the command line
too. The most standard being just saving argc/argv in global variables
yourself. There is also GetCommandLine(), CommandLineToArgv(), etc...
> I suppose the other reason I didn't worry much about this was that I
> wasn't expecting people to write much DLL code without calling any
> C library functions.
Many Win32 functions do the same thing as the C runtime functions. I'm
using some of those. I have heard that a program and DLL should not use a
different C runtime DLL - bad things can happen. My DLL will be used by
many people with different compilers, even different languages. So I don't
want my DLL importing anything from a C runtime DLL.
Want to unsubscribe from this list?
Send a message to email@example.com
More information about the Cygwin