Re: f2cl trouble with common block -- function make-<block name> undefined

Raymond Toy <[email protected]> Fri, 27 Jan 2006 11:20:13 -0500
Newsgroups gmane.lisp.clocc.general
Message-ID <[email protected]>
>>>>> "Robert" == Robert Dodier <[email protected]> writes:

    Robert> Ray, thanks for your help. I've made some progress.
    Robert> (1) SBCL loads f2cl successfully (although with many complaints),
    Robert> and f2cl::f2cl executes successfully, and SBCL loads the
    Robert> resulting translation successfully. Terrific!

I've checked in a change for clisp.  Clisp (2.35) works fine for me
with your test case now.

I also get quite a few errors from cmucl, but I'm too lazy to fix
them, because I think they're harmless.

    Robert> (2) Variables mentioned in DATA statements within
    Robert> BLOCK DATA aren't initialized. A function named
    Robert> /BLOCKDATA-<WHATEVER>/ is defined
    Robert> to initialize the data, but it is not automatically called;
    Robert> if I call the block data function by hand, then the variables are initialized.

Yes, that's a problem, but I'm not sure what the right solution is.
Currently, it's expected that you know what you're doing and how the
Fortran code works so that you call the block data initializer as
needed.

With Fortran, it's pretty easy to do this automatically at "load" time
because programs run just once.  But with Lisp, it's not so clear when
you have a repl and the program can be run many times.  I tend to put
wrappers around stuff as needed, so that the block data is initialized
everytime I run the main program.  Since f2cl may not know about the
block data when it's compiling the main program, there's no way for
f2cl to call the initializer automatically.

    Robert> (3) The program of interest at the moment is LBFGS,
    Robert> a minimization program. If I call the blockdata function to
    Robert> initialize the common variables, the LBFGS test program
    Robert> runs successfully. That's really good news.

Cool!  If you look in the packages directory, you'll find quite a few
other packages, including minpack and hompack.  These were used a
tests for f2cl because they exposed various bugs.  They should work.
Since f2cl seems to have converted LBFGS correctly without tweaking on
your part, it doesn't really expose any regressions in f2cl.  But if
you like, I can add that to the packages as a kind of "supported"
regression test, especially if it comes with a test program.

Ray



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642