1

内容:Office 2007、ExcelDNA 0.30、ActiveState Perl SDK 3.0、PerlNET

我正在尝试使用 PerlNET 编写 ExcelDNA 加载项。这个想法是写一些可以处理可变数量参数的东西,比如=SUM()。

Perl 代码:

#!perl
package AddIn; 

use strict;
use diagnostics; 
use namespace "System";
use PerlNET qw(AUTOCALL);
=for interface
    [interface: pure]
    static double PNSUM(double);
    static double PNSUM(double,double);
    static double PNSUM(double,double,double);
    static double PNSUM(double,double,double,double);
    static double PNSUM(double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
    static double PNSUM(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double);
=cut

sub new {
    my($package) = @_;
    my $self = bless {} => $package;
    return $self;
}

sub PNSUM {
    my $result = 0.0;
    foreach (@_) {
        $result += $_;
    }
    return $result;
}
#~ print SUM(1.9,2.8,3.7,4.6,5.5,6.4,7.3,8.2,9.1);

DNA密码

<DnaLibrary Name="Perl NET Demo" RuntimeVersion="v2.0">
  <ExternalLibrary Path="BOPN.DLL" />
</DnaLibrary>

.XLL 文件加载正常,但 PNSUM() 不可见。我究竟做错了什么?

4

0 回答 0