home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / dll_argv.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  62 lines

  1. /***
  2. *dll_argv.c - __setargv() routine for use with C Run-Time as a DLL (CRTDLL)
  3. *
  4. *       Copyright (c) 1994-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       This object is part of the start-up code for EXE's linked with
  8. *       CRTDLL.LIB/MSVCRT.LIB.  This object will be linked into the user
  9. *       EXE if and only if the user explicitly links with SETARGV.OBJ.
  10. *       The code in this object sets the flag that is passed to the
  11. *       C Run-Time DLL to enable wildcard expansion of the argv[] vector.
  12. *
  13. *******************************************************************************/
  14.  
  15.  
  16. #ifdef CRTDLL
  17.  
  18. #include <cruntime.h>
  19. #include <internal.h>
  20.  
  21. /***
  22. *__setargv - dummy version (for wildcard expansion) for CRTDLL.DLL model only
  23. *
  24. *Purpose:
  25. *       If the EXE that is linked with CRTDLL.LIB is linked explicitly with
  26. *       SETARGV.OBJ, the call to _setargv() in the C Run-Time start-up code
  27. *       (above) will call this routine, instead of calling a dummy version of
  28. *       _setargv() which will do nothing.  This will set to one the static
  29. *       variable which is passed to __getmainargs(), thus enabling wildcard
  30. *       expansion of the command line arguments.
  31. *
  32. *       In the statically-linked C Run-Time models, _setargv() and __setargv()
  33. *       are the actual routines that do the work, but this code exists in
  34. *       CRTDLL.DLL and so some tricks have to be played to make the same
  35. *       SETARGV.OBJ work for EXE's linked with both LIBC.LIB and CRTDLL.LIB.
  36. *
  37. *Entry:
  38. *       The static variable _dowildcard is zero (presumably).
  39. *
  40. *Exit:
  41. *       The static variable _dowildcard is set to one, meaning that the
  42. *       routine __getmainargs() in CRTDLL.DLL *will* do wildcard expansion on
  43. *       the command line arguments.  (The default behavior is that it won't.)
  44. *
  45. *Exceptions:
  46. *
  47. *******************************************************************************/
  48.  
  49. extern int _dowildcard; /* should be in <internal.h> */
  50.  
  51. #ifdef WPRFLAG
  52. void __cdecl __wsetargv ( void )
  53. #else  /* WPRFLAG */
  54. void __cdecl __setargv ( void )
  55. #endif  /* WPRFLAG */
  56. {
  57.         _dowildcard = 1;
  58. }
  59.  
  60. #endif  /* CRTDLL */
  61.  
  62.