forked from hercules-390/hyperion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.MINGW
795 lines (523 loc) · 25 KB
/
README.MINGW
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
******************************************************************
******************************************************************
NOTE! This file is OBSOLETE
and should probably be deleted!
Once we got Herc to build successfully
using MSVC, I/we stopped all effort on
trying to make sure it continued to build
under MinGW. At this late stage I doubt
it will build at all under MinGW! That
is to say, it more than likely will NOT
build under MinGW, and thus the reason
why this README should be deleted. The
only reason I haven't deleted it yet is
simply because of its historical value
since it might be beneficial to someone
should they decide to try on their own
to get Herc to build under MinGW.
-- Fish
******************************************************************
******************************************************************
-------------------------
> > > N O T E < < <
-------------------------
While the below information is probably reasonably accurate,
it should be noted that building Herc with MinGW may no longer
work. (It hasn't been tested in a long time).
The prefered method (and indeed the only SUPPORTED method) for
building the Win32 version of Hercules is via Microsoft's free
compiler toolkit as explained in the README.MSVC document. The
below information is mostly for historical purposes.
******************************************************************
******************************************************************
MINGW PORTING NOTES:
./configure --enable-fthreads --disable-shared --enable-static \
--disable-nls --disable-dynamic-load --disable-external-gui
./configure --enable-fthreads --disable-shared --enable-static \
--disable-nls --disable-dynamic-load --disable-external-gui \
--enable-debug --enable-optimization="-O0 -g"
******************************************************************
******************************************************************
================================================================
================================================================
INSTALLING MSYS + MINGW
================================================================
================================================================
--------------------------------------------------------------
http://www.mingw.org/download.shtml
1. Install MSYS-1.0.10.exe --> d:/msys/1.0
2. Install msysDTK-1.0.1.exe --> d:/msys/1.0
3. Install MinGW-3.1.0-1.exe --> d:/MinGW
In that order!
--------------------------------------------------------------
Create /etc/fstab to point to the mingw dir:
#Win32_Path Mount_Point
d:/mingw /mingw
--------------------------------------------------------------
Create .inputrc in home dir with desired terminal settings.
#--------------------------------------------------------------------------------
# Fish: The following from: http://www.ibb.net/~anne/keyboard/keyboard.html#Bash
#--------------------------------------------------------------------------------
"\e[3~": delete-char
# this is actually equivalent to "\C-?": delete-char
# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H":beginning-of-line
"\e[F":end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~":beginning-of-line
"\e[8~":end-of-line
# --- (eof) ---
--------------------------------------------------------------
Update /etc/profile with desired aliases
# ------- Fish's preferences... -------
export HISTCONTROL=ignoredups
alias less='less -r'
# alias rm='rm -i'
alias whence='type -a'
alias ls='ls -F --color=tty'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias cls='clear'
# --- (eof) ---
--------------------------------------------------------------
(((Optional: you only need to do the following (if desired) if
you plan on using the provided msys shell window (NOT recommended)
instead of your own MSYS Command Prompt window (HIGHLY recommended)
which I explain how to do in the next step just below))))...
Make a copy of the 'msys.bat' file in "d:\msys\1.0" and update it
with your prefered colors and window geometry settings:
rem (deleted by Fish) if "x%MINGW32BGCOLOR%" == "x" set MINGW32BGCOLOR=LightYellow
rem (deleted by Fish) if "x%MINGW32FGCOLOR%" == "x" set MINGW32FGCOLOR=Navy
rem (replaced with the following instead)
if "x%MINGW32BGCOLOR%" == "x" set MINGW32BGCOLOR=Black
if "x%MINGW32FGCOLOR%" == "x" set MINGW32FGCOLOR=#C0C0C0
rem (deleted by Fish) start rxvt -backspacekey . -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr -fn Courier-12 -tn msys -geometry 80x25 -e /bin/sh --login -i
rem (replaced with the following instead)
start rxvt -backspacekey . -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr -fn Courier-12 -tn msys -geometry 100x50 -e /bin/sh --login -i
*** IMPORTANT NOTE! ***
Be VERY CAREFUL when modifiying the above "start rxvt..." line!
The actual .BAT file contains an embedded backspace character
which does not appear on the above example statements! Do NOT
use the above example statements as-is! Instead, use notepad
to manually edit the .bat file itself (being very careful
when you do!).
ALSO, it's important to MAKE A COPY of the msys.bat file and make
your changes to it. This is because the MSYS.BAT file is REPLACED
whenever msys/mingw is updated! Thus, if you fail to make your own
copy of it, your changes will be lost!!
--------------------------------------------------------------
MINGW Command Prompt
As an alternative to the crappy 'GNU' shell window used by default
by MSYS (rxvt?), it's easy enough to setup a native WinNT Command
Prompt window to be your "shell window" instead.
First, create a .bat (batch) file in the 'd:\msys\1.0' directory
called, for example, "fish_msys.bat" (try NOT to use a name with
spaces in it!), with the following statements in it:
@echo off
SET CYGWIN="tty binmode title strip_title" codepage:oem
D:
chdir \msys\1.0\bin
bash --login -i
Yep! That's right. We're setting a 'CYGWIN' environment variable
with the above batch file. The msys/mingw package was ported FROM
Cygwin after all, so, interestingly enough, the above does indeed
do what one expects it to: displays the name of the program being
executed in the window title ('title'), but with the path removed
('strip_title'), just like Cygwin's shell window does.
Next, make a copy of Windows's "Command Prompt" shortcut and modify
it as desired (width, height, etc -- i.e. the window's 'layout').
To turn it into a MINGW Command Prompt window (instead of the native
WinNT Command Prompt window it starts out as), simply modify the
shortcut's "Properties" as follows:
Target: D:\msys\1.0\fish_msys.bat
Start in: D:\msys\1.0\bin
Comment: MINGW Command Prompt
Optional:
Click the "Change Icon..." button, followed by the "Browse..."
button, and navigate to the root MSYS directory ("D:\msys\1.0")
and select the desired icon ("m.ico" or "msys.ico").
DONE!!
Now whenever you click on that shortcut, Windows will open a normal
Command Prompt window with the MINGW (MSYS) shell already started!
Your working directory will automatically be you 'home' directory,
and you'll be able to enter whatever shell commands and/or execute
any shell scripts you need, and the name of the program that's being
executed (without the path) will be displayed in the window's title!
COOL!! :))
(and MUCH better than the crappy window msys/mingw provides IMO)
--------------------------------------------------------------
(Optional): Create a symbolic link for bash.
"sh.exe" is actually bash (at least according to the msys docu-
mentation), so symlink 'bash.exe' to 'sh.exe':
ln -s sh.exe bash.exe
so all of your scripts that start with #!/bin/bash will work.
--------------------------------------------------------------
The handling of quotes on command-lines is different in the
msys shell than it is with cygwin. Thus whereas:
./configure --enable-custom="value with spaces"
used to work fine with cygwin, it no longer works with the
msys shell. Instead, you need to use MICROSOFT command-line
escape rules, and enter the command as follows instead:
./configure --enable-custom=\"value with spaces\"
Note: as far as I know this only applies to manually entering
commands in the msys shell window (i.e. at the command prompt).
I don't believe it applies (i.e. I believe it does NOT apply)
to scripts that happen to issue shell commands for example.
--------------------------------------------------------------
(Optional): Create the '/usr/local/bin' directory so you can
use all of your previously created scripts and private override
programs, etc.
NOTE: the "d:/msys/1.0" directory
is actually the "/usr" directory[*].
Thus, to add our own "/usr/local/bin" directory,
we need to create a "d:/msys/1.0/local/bin" directory.
-----------
* As well as the '/' root directory too, interestingly/confusingly
enough! Refer to the "Automatic file system maps" table in the
"README.rtf" document in the "D:\msys\1.0\doc\msys" directory
for details regarding hard-coded mount points.
--------------------------------------------------------------
Do a hercules 'bldlvlck' to make sure you have everything that
autoconf needs...
Fish@SYSTEM2 ~
$ cd hercules
Fish@SYSTEM2 ~/hercules
$ cd util
Fish@SYSTEM2 ~/hercules/util
$ bldlvlck
This utility will check the level of various utilities needed to build
hercules. Checking is done against versions that are KNOWN to work.
This doesn't mean a build will NOT succeed with older versions
of the utilities, but will give a hint as to what package may need
an upgrade if the build ever fails with some odd reason.
OK SVN (informational), found x.yy
OK autoconf requires 2.5, found 2.56
OK automake requires 1.6, found 1.7.1
INSTALL flex not found
URL: http://www.gnu.org/directory/flex.html
OK gawk requires 3.0, found 3.0.4
OK gcc requires 2.95, found 3.2.3
INSTALL gettext not found
URL: http://www.gnu.org/directory/gettext.html
OK grep requires 0, found 2.5.1
INSTALL iconv not found
URL: http://www.gnu.org/directory/libiconv.html
For first-time Libiconv installs, a recompile and reinstall of gettext
is recommended. Source: libiconv-1.8/README
OK m4 requires 0.0, found 1.4
OK make requires 3.79, found 3.79.1
OK perl requires 5.6, found 5.6.1
OK sed requires 3.02, found 3.02
--------------------------------------------------------------
"http://sourceforge.net/projects/gnuwin32/" lists MANY GnuWin32
packages. Use the "Download" link in the FAR RIGHT COLUMN to
download the following needed packages:
+-------------------------------------------------------
|
| *** FISH ADDENDUM -- Feb 2005 ****
|
| The below "instructions" are WRONG(?) (I think)
| as far as the copying/installation is concerned.
|
| I now believe the PROPER way to "install" an
| external package meant for MSYS is to simply un-
| zip it (extract it) directly into the main msys
| directory, letting WinZip (or whatever zip util
| you happen to be using), allowing it to automatically
| overlay whatever files it needs to overlay/replace
| and allowing it to automatically create whatever
| directories it needs to create (as needed according
| to whatever is contained in the zip file).
|
| I haven't yet tried it myself yet, but I believe
| that's all you need to do: unzip into msys and
| that's it. (But as I said, I haven't confirmed
| that yet).
|
| So in the below instructions, try:
|
| replace: "copy to /usr/local/bin"
| with: "unzip into msys"
|
| instead.
|
+-------------------------------------------------------
gettext-0.14.1-bin.zip
contains "gettext.exe" (and many other exes/dlls)
in the 'bin' directory
copy "gettext.exe" (and many other exes/dlls)
to /usr/local/bin.
(Recall that according to msys documentation the "d:/msys/1.0"
directory is actually your '/usr' directory)
gettext-0.14.1-dep.zip
contains "libiconv2.dll"
in the 'bin' directory
needed by gettext.exe
copy "libiconv2.dll" to /usr/local/bin
libiconv-1.8-1-bin.zip
contains "iconv.exe" and most (but not all!) support dlls
in the 'bin' directory
copy "iconv.exe" and most (but not all!) support dlls
to /usr/local/bin
libintl-0.11.5-2-bin.zip
contains "libintl-2.dll"
in the 'bin' directory
needed by iconv.exe
copy "libintl-2.dll" to /usr/local/bin.
---------------------------------------
Do we need the below?? I'm thinking
that maybe we might for linking Herc
---------------------------------------
libiconv-1.8-1-lib.zip
contains ".a" and ".lib" files
in the 'lib' directory
used to link hercules with
copy ".a" and ".lib" files to ???????
contains *.h files
in the 'include' directory
used to compile hercules with
copy *.h files to ???????
================================================================
================================================================
HERCULES MODIFICATIONS
================================================================
================================================================
---------------------------------------
>>> NLS disabled for the time being <<<
---------------------------------------
I keep getting errors when the intl directory is built:
plural.y: In function `__gettextlex':
plural.y:263: error: argument "pexp" doesn't match prototype
plural.y:69: error: prototype declaration
plural.y: In function `__gettexterror':
plural.y:407: error: argument "str" doesn't match prototype
plural.y:70: error: prototype declaration
plural.y: At top level:
plural.y:406: warning: unused parameter 'str'
For the time being I'm skipping past it via "--disable-nls"
but it needs to be looked into.
--------------------------------------------------------------
No biggee, but '-traditional-cpp', while originally (and for now)
added (by Jay?) specifically for Apple builds, doesn't work for
non-Apple builds. (I tried it.)
It keeps issuing warnings regarding extra tokens on #endif and
#include statements.
I added '-Wno-endif-labels" to get rid of the warnings for #endifs,
but can't find an option to suppress the warnings for #includes!
But as I said, it's not a big problem right now since, as it's
coded right now, we're only adding '-traditional-cpp' for Apple
and ONLY for Apple builds.
Note too, that we COULD get rid of all such warnings by simply
coding our comments (on #endif and #include statements) using
/* */ instead of //, but I'm too lazy to change them all right
now; maybe later if I'm in the mood...
--------------------------------------------------------------
Created 'hthreads.h', 'hostopts.h', w32util.h/c'.
'hostopts.h' now contains the host specific options that
used to be in featall.h. (I want to try and place all host-
specific tests in one convenient place, replacing all #ifdef
WIN32 and #ifdef __APPLE__, etc tests with #ifdef FEATURE_XXX.
Doing that is more portable and makes porting efforts easier.
--------------------------------------------------------------
I was hoping to avoid having to do it, but in the end I had
no other choice; trying to keep it was simply causing too much
trouble and making the code too sloppy trying to finagle things
to try and keep it.
Soooooo.....
I had to rename the Hercules 'DWORD' type to 'DBLWRD' so as to
not conflict with Microsoft's existing DWORD typedef. <grumble>
I kept the HWORD and FWORD typedefs as-is.
--------------------------------------------------------------
sie.c: added "#if !defined(NO_SIGABEND_HANDLER)":
DEF_INST(start_interpretive_execution)
...
logmsg (_("HHCCP079E CPU%4.4X: calloc failed...
...
#if !defined(NO_SIGABEND_HANDLER)
signal_thread(sysblk.cputid[regs->cpuad], SIGUSR1);
#endif
...
--------------------------------------------------------------
ieee-w32.h:
Changed all instances of: u_int32_t
to: uint32_t
since that seems to be the "Hercules standard" according to
what I can see in the 'htypes.h' header.
(Same with 'u_int64_t' too: changed them all to 'uint64_t').
--------------------------------------------------------------
cckddasd, cckdutil, etc...
Created:
'get_file_accmode_flags' --> "Poor man's" fcntl( fd, F_GETFL )
(only returns access mode flags not any others...)
--------------------------------------------------------------
Created: 'hconsts.h', 'hmacros.h', 'hstructs.h', 'hexterns.h'
to make "hercules.h" smaller/simpler and to basically make
things a bit easier to maintain... (helps to keep things more
organized IMO)
--------------------------------------------------------------
commadpt.c:
rc = fcntl( tempfd, F_GETFL );
rc |= O_NONBLOCK;
fcntl( tempfd, F_SETFL, rc );
Changed to:
socket_set_blocking_mode(tempfd,0);
Also created:
'socket_init()' and 'socket_deinit()'
functions since Windows Socket 2 requires calling 'WSAStartup'
and 'WSACleanup'. (calls are in 'impl' function in impl.c)
--------------------------------------------------------------
Started trying to remove all #ifdef WIN32, etc, and replace
with #ifdef XXXXX (where 'XXXX' is some feature name), (see
next item for good example), but haven't finished yet...
--------------------------------------------------------------
hercifc.c:
ctc_ctci.c:
ctc_lcs.c:
tuntap.c:
Changed #ifndef __APPLE__ with #ifdef OPTION_TUNTAP_SETNETMASK,
etc, and #defined or #undef'ed OPTION_TUNTAP_SETNETMASK, etc
as needed in new 'hostopts.h' member.
--------------------------------------------------------------
feature.h:
I see:
#if defined(WIN32) && !defined(__WORDSIZE)
#define __WORDSIZE 32
#endif
but __WORDSIZE doesn't seem to be used at all (there are a
few statements but they're commented out).
Can this be safely removed?? (it probably cam, but I'm thinking
it might be something in preparation for 64-bit builds, which
is why I'm asking)
--------------------------------------------------------------
vm.c:
void ARCH_DEP(extid_call) (int r1, int r2, REGS *regs)
...
/* Bytes 16-23 contain the userid in EBCDIC */
#if defined( HAVE_GETLOGIN_R )
memset( unam, 0, sizeof(unam) );
VERIFY( getlogin_r ( unam, sizeof(unam) ) == 0 );
puser = unam;
#else
puser = "";
#endif
for (i = 0; i < 8; i++)
{
c = (*puser == '\0' ? SPACE : *(puser++));
buf[16+i] = host_to_guest(toupper(c));
}
--------------------------------------------------------------
You will see a LOT of "comparison between signed and unsigned"
warnings during the build (esp. in 'commadpt.c' for example)
due to Microsoft's 'FD_SET' macro implementation. There's no
simple way to work around it so just ignore it for now...
--------------------------------------------------------------
tapedev.c:
Had to make extensive modifications to 'mountnewtape' function
due to non-existence of regular expression library in MinGW.
Luckily the patterns we're checking for are rather simple, so
it wasn't that difficult to do. My question is WHY we're doing
it via regular expressions in the first place??
--------------------------------------------------------------
ctcadpt.c:
Support for VMNET is gen'ed, but will not work until Win32
equivalent for 'fork' is developed. 'fork' simply returns -1
at the moment. ('fork' might take a while to port!)
--------------------------------------------------------------
hdl.h:
minor fix: check if LTDL_SHLIB_EXT defined too when #defining
HDL_MODULE_SUFFIX.
--------------------------------------------------------------
Various... (many different places...)
Unfortunately, MinGW always links with Micro$oft's MSVCRT
runtime library. Thus, all scanf/printf format flags must use
the Micro$oft format, which, for 64-bit values, is completely
different from the GNU format.
GNU uses "%lld", "%llx", %16.16llX, etc.
whereas Micro$oft uses "%I64d", "%I64x", %16.16I64X, etc.
Thus I had to #define the following (in 'hconsts.h'):
#ifdef WIN32
# define LL_FMT "I64"
#else
# define LL_FMT "ll"
#endif
and change all occurrences of: "%lld"
with: "%"LL_FMT"d"
which is so UGLY beyond belief it's pitiful. :(
--------------------------------------------------------------
(Various): workaround inability to redirect 'stdout'...
The logger thread in logger.c redirects the write end of the
logmsg pipe into STDOUT via dup2, but unfortunately, the way
I'm currently handling the logmsg pipes for this MinGW port
(wherein the pipe is actually just a socketpair connected to
each other), that technique no longer works (since in Win32
you can't do 'dup2' on sockets) and thus I have it commented
out (since we actually don't really need to do the dup2 at all
as long as everyone uses the 'logmsg' macro for their i/o).
Unfortunately however, the "display_version" function (and
indirectly the "display_hostinfo" function which display_version
calls) are coded to "fprintf" to whatever FILE* is passed
(which is usually stderr for the utilities and stdout for
Hercules (impl.c)).
Thus, in those two places -- and only in those two places --
I had to code a duplicate 'print' call: one that fprintf'd
to stderr, and the other to do a 'logmsg'. When the utilities
call it (display_version), they pass stderr and I do fprintf
to stderr, but when if stdout is passed (as it is when impl.c
calls it), then I do a logmsg.
I haven't thought whether there's an easier/better way to do
things; I just want to get this damn port FINISHED for now!
I can go back and clean things up later. Okay?
***********************************************************************
***********************************************************************
***********************************************************************
** TODO ** (( U N R E S O L V E D I S S U E S ))
(moved to README.MSVC)
***********************************************************************
***********************************************************************
***********************************************************************
From the MinGW 'FAQ' @ <http://www.mingw.org/mingwfaq.shtml#faq-msvcdll>
...
How can an MSVC program call a MinGW DLL, and vice versa?
---------
Assume we have a testdll.h, testdll.c, and testmain.c. In the first case, we will compile
testdll.c with MinGW, and let the MSVC-compiled testmain call it. You should use
gcc -shared -o testdll.dll testdll.c \
-Wl,--output-def,testdll.def,--out-implib,libtestdll.a
to produce the DLL and DEF files. MSVC cannot use the MinGW library, but since you already have
the DEF file you may easily produce one by the Microsoft LIB tool:
lib /machine:i386 /def:testdll.def
Once you have testdll.lib, it is trivial to produce the executable with MSVC:
cl testmain.c testdll.lib
---------
Now for MinGW programs calling an MSVC DLL. We have two methods. One way is to specify
the LIB files directly on the command line after the main program. For example, after
cl /LD testdll.c
use
gcc -o testmain testmain.c testdll.lib
<doesn't work; see below>
The other way is to produce the .a files for GCC. For __cdecl functions (in most cases),
it is simple: you only need to apply the 'reimp' tool from Anders Norlander (since his
web site is no longer available, you may choose to download here a version enhanced by
Jose Fonseca):
reimp testdll.lib
gcc -o testmain testmain.c -L. -ltestdll
</doesn't work; see below>
However, for __stdcall functions, the above method does not work. For MSVC will prefix
an underscore to __stdcall functions while MinGW will not. The right way is to produce
the DEF file using the 'pexports' tool included in the mingw-utils package and filter
off the first underscore by sed:
pexports testdll.dll | sed "s/^_//" > testdll.def
Then, when using dlltool to produce the import library, add `-U' to the command line:
dlltool -U -d testdll.def -l libtestdll.a
And now, you can proceed in the usual way:
gcc -o testmain testmain.c -L. -ltestdll
Hooray, we got it.
***********************************************************************
***********************************************************************
***********************************************************************