On Sat, 2005-02-05 at 19:32 +0100, Ron Blaschke wrote: > This patch adds all missing export symbols to libnci_test.dll that are > needed by t/pmc/nci.t.
Why not generate the .def file instead of hoping that people add the correct symbols? Here's a patch that seems to do the trick for me (though not running Windows, I can't really test if the defines are all correct). -- c
Index: MANIFEST =================================================================== RCS file: /cvs/public/parrot/MANIFEST,v retrieving revision 1.831 diff -u -u -r1.831 MANIFEST --- MANIFEST 2 Feb 2005 12:23:22 -0000 1.831 +++ MANIFEST 5 Feb 2005 20:54:32 -0000 @@ -2764,7 +2765,6 @@ src/list.c [] src/library.c [] src/longopt.c [] -src/libnci_test.def [] src/malloc-trace.c [] src/malloc.c [] src/memory.c [] Index: config/gen/makefiles/root.in =================================================================== RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v retrieving revision 1.273 diff -u -u -r1.273 root.in --- config/gen/makefiles/root.in 2 Feb 2005 12:23:25 -0000 1.273 +++ config/gen/makefiles/root.in 5 Feb 2005 20:54:34 -0000 @@ -908,6 +908,9 @@ $(SRC_DIR)/nci.c : $(SRC_DIR)/call_list.txt $(BUILD_TOOLS_DIR)/build_nativecall.pl $(PERL) $(BUILD_TOOLS_DIR)/build_nativecall.pl $(SRC_DIR)/call_list.txt +$(SRC_DIR)/ncitest.def : $(SRC_DIR)/nci.c $(BUILD_TOOLS_DIR)/build_ncitest_def.pl + $(PERL) $(BUILD_TOOLS_DIR)/build_ncitest_def.pl $(SRC_DIR)/nci.c + $(SRC_DIR)/warnings$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/misc$(O) : $(GENERAL_H_FILES) @@ -1369,7 +1372,7 @@ ###### OS depend targets ########## # for use by t/pmc/nci.t -$(LIBNCI_SO): $(SRC_DIR)/nci_test$(O) +$(LIBNCI_SO): $(SRC_DIR)/nci_test$(O) $(SRC_DIR)/libnci_test.def $(LD) $(LD_LOAD_FLAGS) ${ncilib_link_extra} $(LDFLAGS) \ $(LD_OUT)$@ $(SRC_DIR)/nci_test$(O) --- /dev/null 1969-12-31 16:00:00.000000000 -0800 +++ build_tools/build_ncitest_def.pl 2005-02-05 12:56:01.000000000 -0800 @@ -0,0 +1,83 @@ +#! perl -w +# Copyright: 2005 The Perl Foundation. All Rights Reserved. +# $Id$ + +=head1 NAME + +build_tools/build_ncitest.def - Build up the native call test library defines + +=head1 SYNOPSIS + + % perl build_tools/build_ncitest_def.pl src/nci_test.c + +=head1 DESCRIPTION + +This script creates the definition file for the exported symbols from the +Native Call Interface test file F<src/nci_test.c>. It parses that file for +function and variable signatures and writes the results to +F<src/libnci_test.def>. + +=head1 SEE ALSO + +F<src/call_list.txt>. +F<docs/pdds/pdd16_native_call.pod>. +F<build_tools/build_nativecode.pl>. + +=cut + +use strict; + +# This file will eventually be compiled +open DEF, ">src/libnci_test.def" or die "Can't open src/libnci_test.def: $!\n"; + +# This is the source file +open IN, "<$ARGV[0]" or die "Can't read $ARGV[0]: $!\n"; + +print_head(); +find_symbols(); + +sub print_head { + print DEF << 'HEAD'; +/* + * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! + * + * This file is generated automatically by build_tools/build_ncitest_def.pl + * + * Any changes made here will be lost! + * + */ +LIBRARY libnci_test +DESCRIPTION 'Shared lib for testing the Parrot Native Call Interface' +EXPORTS +HEAD +} + +sub find_symbols { + my (%functions, %variables); + + while (<IN>) + { + next unless /^\w+\s+(?:\*?\s+)?(nci_\w+)(.*);/; + my ($name, $declaration) = ($1, $2); + + if ($declaration =~ /\(.+\)/) + { + $functions{ $name }++; + } + elsif ($declaration =~ /\s+=/) + { + $variables{ $name }++; + } + else + { + warn "Unknown symbol $name: $_\n"; + } + } + + print_symbols( sort keys %functions ); + print_symbols( sort keys %variables ); +} + +sub print_symbols { + print DEF " $_\n" for @_; +}