Mail Archives: djgpp/1999/01/02/20:23:38
Thiago F.G. Albuquerque (thiagofga AT ambr DOT com DOT br) wrote:
: The documentation says one could disable the command line wildcard
: expansion by providing a __ctr0_glob_function() that always returned NULL.
: But I found out this only works with C source files. This can be tested
: this way:
:
: #include <stdio.h>
:
: char **__crt0_glob_function(char *_argument)
: {
: printf("This is __crt0_glob_function\n");
: return NULL;
: }
:
: int main(int argc, char *argv[])
: {
: int i;
: for(int i=0; i<argc; i++)
: printf("%s\n", argv[i]);
:
: return 0;
: }
:
: save this as glob.c, compile it and run. Then rename the source file to
: glob.cpp and rebuild it. You will notice the C version prints the message,
: while the C++ doesn't.
:
: Is there a way around this?
I'm no expert on C++, but it seems you have to declare
__crt0_glob_function() as "extern C" (or whatever it's called - that's
how small a C++ expert I am) or put it in a file compiled as C not
C++. It's a C function not a C++ function.
Holmboe, Symphony No. 6,
MartinS
- Raw text -