Greetings esteemed monks,

I have successfully wrapped a Fortran subroutine in C and run it, and then incorporated the C code into PerlXS code (see below), and everything compiles except for a warning at the make stage for the xs about "Clock skew detected. the fortran file was also compiled.

.

When I tried to either link the C and Fortran codes as in the C and Fortran case it throws a lot of "undefined references" and when I run a .pl file that has the subroutine, it outputs "symbol lookup error". My question is, should I include some kind of header file? I have already installed ExtUtils::F77.pm but have only included it in the .pl file. Below I included the xs code, please assume that the .f code is a subroutine that compiles and runs.

Thanks in advance, newbie_sunny
**** hfuncs.xs***** #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include <stdio.h> #include <complex.h> #include <math.h> #include "ppport.h" MODULE = hfuncs PACKAGE = hfuncs void for_sub_(int &i,double &x, double &y, int &ny) PPCODE: for_sub_(&i, &x, y, &ny); ***** test.pl **** #! /opt/perl5/bin/perl -w use ExtUtils::testlib; use ExtUtils::F77; use hfuncs; use lib "/usr/lib/perl5/site_perl/5.8.8/ExtUtils/F77"; use lib "/u0/lib/perl5/site_perl/5.8.8/ExtUtils/F77"; $i=1; $ny=3; $x = 3.14159; @y = (1.1, 2.2, 3.3); printf "Perl calling Fortran subroutine, passing\n"; printf"i= $i, x= $x\n"; printf"y[] = $y[0], $y[1], $y[2]\n"; hfuncs::for_sub_(\$i, \$x, \@y, \$ny);

In reply to Wrapping a Fortran subroutine in PerlXS code by newbie_sunny

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.