This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Oe Aug 17 07:31, Agner Fog wrote: > > So errno was a bad example but you can try accessing e.g. __ctype_ptr__, > > __progname, optarg, h_errno, or use FE_DFL_ENV from another DLL, just > > for kicks. > __ctype_ptr__ is a function > > h_errno works like errno with an imported function > > FE_DFL_ENV is a macro > > __progname and optarg are local variables to each exe or dll That would contradict what, e.g., __progname is for. Here's a test: $ cat > dll.c <<EOF #include <stdio.h> extern char *__progname; void printprog () { printf ("progname: %s\n", __progname); } EOF $ cat > main.c <<EOF extern void printprog(); int main () { printprog (); } EOF $ uname -a CYGWIN_NT-10.0 vmbert10 3.1.0(0.340/5/3) 2019-08-16 14:36 x86_64 Cygwin Lets try the medium model first: $ gcc -g -shared -mcmodel=medium -o dll.dll dll.c $ gcc -g -mcmodel=medium -o main main.c dll.dll $ ./main progname: main Now let's try the small model: $ gcc -g -shared -mcmodel=small -o dll.dll dll.c $ gcc -g -mcmodel=small -o main main.c dll.dll $ ./main Cygwin runtime failure: /home/corinna/main.exe: Invalid relocation. Offset 0xfffffffd80348989 at address 0x40000103b doesn't fit into 32 bits Now let's try without explicit mcmodel on the CLI: $ gcc -g -shared -o dll.dll dll.c $ gcc -g -o main main.c dll.dll $ ./main progname: main > gcc is using the small memory model by default in Cygwin64, and it works. No, it's not, see above. > clang is using the small memory by default when cross-compiling for a Cygwin64 target from Linux, and it works. ...in *your* example code. Corinna -- Corinna Vinschen Cygwin Maintainer
Attachment:
signature.asc
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |