1
From: courierdavid@hotmail.com
2
Newsgroups: comp.lang.awk
3
Subject: Re: Compiling gawk extensions under Cygwin
4
Date: 14 Mar 2005 20:47:09 -0800
5
Organization: http://groups.google.com
7
Message-ID: <1110862029.175727.109280@o13g2000cwo.googlegroups.com>
8
References: <1e4e8dbe.0501140813.18248833@posting.google.com>
9
<u62nb2-pro.ln1@news.heiming.de>
10
NNTP-Posting-Host: 194.237.142.24
12
Content-Type: text/plain; charset="iso-8859-1"
13
X-Trace: posting.google.com 1110862033 8921 127.0.0.1 (15 Mar 2005 04:47:13 GMT)
14
X-Complaints-To: groups-abuse@google.com
15
NNTP-Posting-Date: Tue, 15 Mar 2005 04:47:13 +0000 (UTC)
17
Complaints-To: groups-abuse@google.com
18
Injection-Info: o13g2000cwo.googlegroups.com; posting-host=194.237.142.24;
19
posting-account=Iz4C5wwAAABx1yG_ft8eEAI99Wu1Tku1
20
Path: news.012.net.il!seanews2.seabone.net!newsfeed.albacom.net!news.mailgate.org!newsfeed.stueberl.de!proxad.net!64.233.160.134.MISMATCH!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail
21
Xref: news.012.net.il comp.lang.awk:21835
23
Thanks for your help there Michael. I wouldn't have thought of that one
24
myself without your help :-)
26
Anyway - for those who must stick with Cygwin here's a method that
27
works using the mingw32 makefiles and some modifications:
29
Basically you need to extract all exportable symbol names from the
30
gawk.exe file into a text file and then create a dummy library file
31
which we can link against on Cygwin. You then throw the library file
32
away because in reality we use the gawk.exe file as the provider of
35
1. First grab the gawk source, e.g. gawk-3.1.4.tar.bz2 and decompress
37
2. Move to the gawk-3.1.4 directory you just created.
38
3. cp pc/* . (copy the pc directory into the main one)
39
4. edit makefile - uncomment lines "DYN_FLAGS", "DYN_EXP", "DYN_OBJ"
40
and "DYN_MAKEXP=$(DMEmingw32)
41
5. make mingw32 (make a gawk.exe)
42
6. run "gcc -o gawk.exe array.o builtin.o eval.o field.o gawkmisc.o
43
io.o main.o ext.o msg.o node.o profile.o re.o version.o dlfcn.o
44
gawk.exp awkgram.o getid.o popen.o getopt.o getopt1.o dfa.o regex.o
45
random.o" (i.e. remove the -s from the compile command from the
46
makefile so the symbols are left in gawk.exe)
48
now export all symbols from gawk.exe into foo.def so that we can put
50
7. echo EXPORTS > foo.def
51
8. nm gawk.exe | grep -E ' [TBD] _' | sed 's/.* [TBD] _//' >> foo.def
52
9. cp foo.def gawkw32.def
54
build the new library with all symbols included
57
Now you will see a file "libgawk.a" which you can link against to
58
create extensions. For example to build an extension called "file" run:
60
gcc -shared -dll -DHAVE_CONFIG_H -I . extension/file.c -o file.dll -L .
63
Then you can load it in gawk using the expression:
65
extension("./file.dll", "dlload");
67
You must use the gawk you compiled from source though. It won't work
68
with any other gawk unfortunately :-( But that's OK because the
69
stripped gawk is not too big in size.
74
Michael Heiming wrote:
75
> In comp.lang.awk David Smith <courierdavid@hotmail.com>:
76
> > Has anyone managed to compile gawk extensions (such as "filefuncs")
79
> Solution is pretty simple, install a real OS, Linux/*BSD or any
80
> other unix and this and further problems won't happen.
85
> Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
86
> mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
87
> #bofh excuse 242: Software uses US measurements, but the OS