summaryrefslogtreecommitdiff
path: root/w32-dll/build-def
blob: 75b39fa584fa26b99710a893c27415751cfbcfff (plain)
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
#!/usr/bin/perl -w
# Run this to generate the .def file for the libgcrypt W32 DLL
#
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$gcrypt_h = "../src/gcrypt.h";
$i = 1;
$header_passed = 0;

open( FD, $gcrypt_h ) || die "$gcrypt_h: $!";
@filebuf = <FD>;
close( FD );

open( FD, ">libgcrypt.def" ) || die "$!";
print FD "EXPORTS\n";
foreach $in( @filebuf ) {
    if( $in =~ m/GCRYPT_VERSION/ ) {
        $header_passed = 1;
    }
    if( $header_passed == 1 && $in !~ m/\#define/ && $in !~ m/\t/ 
        && $in !~ m/\*\// ) {
        if( $in =~ m/gcry_/ && $' =~ m/\(/ ) {
            print FD "\tgcry_$` \@$i\n";
            $i++;
        }
    }
}
close( FD );