[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem with output from FORTRAN77 code
From: |
Martin Buenner |
Subject: |
problem with output from FORTRAN77 code |
Date: |
Wed, 01 Mar 2000 17:31:56 +0100 |
Dear octave-users and developpers,
I would like to dynamically link extensive fortran77-code to octave. To
that end I wrote a C++ wrapper, which calls the f77-routine.
I boiled down the problem to the following. I use a simple C++wrapper
which gives an integer to a fortran routine. The fortran routine opens a
file with that unit number and is supposed to write some text to that
file:
This is file testausgabe.cc:
===========================
#include <octave/oct.h>
extern "C" void testaus(int *IOUT);
DEFUN_DLD(testausgabe, args , , "The `oregonator'.")
{
int IOUT;
ColumnVector x = args(0).vector_value ();
IOUT=(int) x(0);
testaus(&IOUT);
return octave_value (x);
}
This is file testaus.f:
=======================
SUBROUTINE TESTAUS(IOUT)
implicit none
INTEGER IOUT
write(*,*) "IOUT=", IOUT
OPEN(UNIT=IOUT, FILE='nlpql.out', STATUS='UNKNOWN')
write(IOUT,*) 'file opened in gw-nlpql'
write(IOUT,*) 'file closed in gw-nlpql'
CLOSE(UNIT=IOUT)
RETURN
END
I make the *.oct file with
g77 -c -fPIC -O -Wall -fno-globals -fno-underscoring testaus.f -o
testaus.o
c++ -c -fPIC -I/opt/pubdom/include -I/opt/pubdom/include/octave-2.0.14
-fno-rtti -fno-exceptions -fno-implicit-templates -O2 -Wall
testausgabe.cc -o testausgabe.o
c++ -shared -fPIC -o testausgabe.oct testaus.o testausgabe.o -lg2c
The result is testausgabe.oct
Inside octave I type.
>> testausgabe(10)
IOUT= 10
ans = 10
As a result the files 'nlpql.out' and 'fort.10' are created, both of
them being empty. When I exit octave the text is written to 'fort.10'
which then includes
file opened in gw-nlpql
file closed in gw-nlpql
Does anybody know what the problem is and what I can do?
Best regards, Martin
PS: octave_config_info is:
ans =
{
bindir = /opt/pubdom/bin
imagepath = .:/opt/pubdom/share/octave/2.0.14/imagelib//
F2CFLAGS =
FLIBS = -lg2c -lm -L/lib/pa1.1 -L/usr/lib/pa1.1 -u main
-L/opt/pubdom/lib/gcc-lib/hppa2.0-hp-hpux10.20/2.95.1 -L/usr/ccs/bin
-L/usr/ccs/lib -L/opt/pubdom/lib -lm
CPPFLAGS =
CFLAGS = -DHAVE_CONFIG_H -O2 -Wall
CXXFLAGS = -DHAVE_CONFIG_H -fno-rtti -fno-exceptions
-fno-implicit-templates -O2 -Wall
LEXLIB =
datadir = /opt/pubdom/share
localfcnfiledir = /opt/pubdom/share/octave/site/m
CPICFLAG = -fPIC
CXXPICFLAG = -fPIC
exec_prefix = /opt/pubdom
startupfiledir = /opt/pubdom/share/octave/2.0.14/m/startup
TERMLIBS = -lcurses
LIBS = -ldld -lm
LIBPLPLOT =
DEFS = -DOCTAVE_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=":"
-DUSE_READLINE=1 -D__NO_MATH_INLINES=1 -DCXX_NEW_FRIEND_TEMPLATE_DECL=1
-DHAVE_LIBM=1 -DF77_APPEND_UNDERSCORE=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4
-DSIZEOF_LONG=4 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DNPOS=string::npos
-DSTDC_HEADERS=1 -DHAVE_DIRENT_H=1 -DTIME_WITH_SYS_TIME=1
-DHAVE_SYS_WAIT_H=1 -DHAVE_ASSERT_H=1 -DHAVE_CURSES_H=1 -DHAVE_FCNTL_H=1
-DHAVE_FLOAT_H=1 -DHAVE_FNMATCH_H=1 -DHAVE_GLOB_H=1 -DHAVE_GRP_H=1
-DHAVE_LIMITS_H=1 -DHAVE_MEMORY_H=1 -DHAVE_NAN_H=1 -DHAVE_PWD_H=1
-DHAVE_SGTTY_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_STAT_H=1
-DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_SYS_TYPES_H=1
-DHAVE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PRINTF=1 -DHAVE_WAITPID=1
-DHAVE_LIBDLD=1 -DHAVE_SHL_LOAD=1 -DHAVE_SHL_FINDSYM=1 -DWITH_SHL=1
-DWITH_DYNAMIC_LINKING=1 -DHAVE_FINITE=1 -DHAVE_ISNAN=1 -DHAVE_ISINF=1
-DHAVE_ACOSH=1 -DHAVE_ASINH=1 -DHAVE_ATANH=1 -DHAVE_ERF=1 -DHAVE_ERFC=1
-DHAVE_ST_BLKSIZE=1 -DHAVE_ST_BLOCKS=1 -DHAVE_ST_RDEV=1 -DHAVE_TZNAME=1
-DHAVE_GR_PASSWD=1 -DEXCEPTION_IN_MATH=1 -DRETSIGTYPE=void
-DHAVE_POSIX_SIGNALS=1 -DHAVE_GETRUSAGE=1 -DHAVE_TIMES=1
-DGNUPLOT_HAS_MULTIPLOT=1 -DGNUPLOT_HAS_FRAMES=1
default_pager = less
infodir = /opt/pubdom/info
FFLAGS = -O
F2C =
CXX = c++ 2.95.1 19990816 (release)
RLD_FLAG = -Xlinker +b -Xlinker /opt/pubdom/lib/octave-2.0.14
dld = 1
archlibdir = /opt/pubdom/lib/octave/2.0.14/exec/hppa1.1-hp-hpux10.20
fcnfilepath =
.:/opt/pubdom/lib/octave/site/oct/hppa1.1-hp-hpux10.20//:/opt/pubdom/share/octave/site/m//:/opt/pubdom/lib/octave/2.0.14/oct/hppa1.1-hp-hpux10.20//:/opt/pubdom/share/octave/2.0.14/m//
F77 = g77
FPICFLAG = -fPIC
LIBFLAGS = -L/opt/pubdom/lib/octave-2.0.14
localstartupfiledir = /opt/pubdom/share/octave/site/m/startup
octfiledir = /opt/pubdom/lib/octave/2.0.14/oct/hppa1.1-hp-hpux10.20
configure_options = --prefix=/opt/pubdom --enable-shl --enable-shared
--libexec=/opt/pubdom/lib
LDFLAGS = -g
prefix = /opt/pubdom
libdir = /opt/pubdom/lib
fcnfiledir = /opt/pubdom/share/octave/2.0.14/m
localoctfilepath =
/opt/pubdom/lib/octave/site/oct/hppa1.1-hp-hpux10.20//
canonical_host_type = hppa1.1-hp-hpux10.20
CC = gcc 2.95.1 19990816 (release)
LIBDLFCN =
localfcnfilepath = /opt/pubdom/share/octave/site/m//
localarchlibdir =
/opt/pubdom/lib/octave/site/exec/hppa1.1-hp-hpux10.20
INCFLAGS = -I/opt/pubdom/include -I/opt/pubdom/include/octave-2.0.14
}
--
*****************************************************************
* Dr. Martin J. Buenner *
* EPCOS AG *
* Surface Acoustic Wave Components *
* OFW E NT *
* Anzinger Str. 13 Phone: ++49 89 636 26182 *
* D-81617 Munich Fax: ++49 89 636 27304 *
* Germany E-mail: address@hidden *
*****************************************************************
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- problem with output from FORTRAN77 code,
Martin Buenner <=