jens.o...@gmail.com
unread,Apr 24, 2013, 6:53:14 AM4/24/13You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hello!
Im on a Windows x64 machine with i7 and Cygwin 4.5.3.
In mango.f95 I have two subroutines and only those
"
subroutine MyAdd(z, a, b) C(Bind, name = "MyAdd")
!GCC$ ATTRIBUTES DLLEXPORT::myadd
integer, intent (out) :: z
integer, intent (in) :: a
integer, intent (in) :: b
integer :: n
integer :: k
integer :: t
integer :: i
n = a
k = b
t = 1
if (k.LT.(n - k)) then
do i = n, (n - k + 1), (-1)
t = t*i/(n - i + 1)
end do
else
do i = n, (k + 1), (-1)
t = t*i/(n - i + 1)
end do
end if
z = t
end subroutine MyAdd
subroutine MyPBP( S, p, N ) C(Bind, name ="MyPBP")
!GCC$ ATTRIBUTES DLLEXPORT::mypbp
! This function computes the Poisson-Binomial distribution
! of size N using p
double precision, intent(inout) :: S(N+1)
double precision, intent(in) :: p(N)
integer, intent(in) :: N
double precision :: X(N+1)
integer i, j
X=0
S=0
X(1) = 1 - p(1)
X(2) = p(1)
do i = 2, N
S(1) = X(1)*(1-p(i))
do j = 2,i
S(j) = X(j-1)*p(i) + X(j)*(1-p(i))
end do
S(i+1) = X(i)*p(i)
X = S
end do
S = X
end subroutine MyPBP
"
Trying to compile with
gcc -c mango.f95
gfortran -c mango.f95
gfortran -c mango.f95
All three resulting in the same error
Använder inbyggda specifikationer.
COLLECT_GCC=gfortran-4
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.5.3/lto-wrapper.exe
Mål: i686-pc-cygwin
Konfigurerad med: /gnu/gcc/releases/respins/4.5.3-3/gcc4-4.5.3-3/src/gcc-4.5.3/configure --srcdir=/gnu/gcc/releases/respins/4.5.3-3/gcc4-4.5.3-3/src/gcc-4.5.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --datarootdir=/usr/share --docdir=/usr/share/doc/gcc4 -C --datadir=/usr/share --infodir=/usr/share/info --mandir=/usr/share/man -v --with-gmp=/usr --with-mpfr=/usr --enable-bootstrap --enable-version-specific-runtime-libs --libexecdir=/usr/lib --enable-static --enable-shared --enable-shared-libgcc --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-lto --enable-java-awt=gtk --disable-symvers --enable-libjava --program-suffix=-4 --enable-libgomp --enable-libssp --enable-libada --enable-threads=posix --with-arch=i686 --with-tune=generic --enable-libgcj-sublibs CC=gcc-4 CXX=g++-4 CC_FOR_TARGET=gcc-4 CXX_FOR_TARGET=g++-4 GNATMAKE_FOR_TARGET=gnatmake GNATBIND_FOR_TARGET=gnatbind --with-ecj-jar=/usr/share/java/ecj.jar
Trådmodell: posix
gcc version 4.5.3 (GCC)
COLLECT_GCC_OPTIONS='-c' '-v' '-mtune=generic' '-march=i686'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/f951.exe main.f95 -quiet -dumpbase main.f95 -mtune=generic -march=i686 -auxbase main -version -fintrinsic-modules-path /usr/lib/gcc/i686-pc-cygwin/4.5.3/finclude -o /tmp/cc9sIIp3.s
GNU Fortran (GCC) version 4.5.3 (i686-pc-cygwin)
kompilerad med GNU C version 4.5.3, GMP-version 4.3.2, MPFR-version 3.0.1-p4, MPC-version 0.8
GGC heuristik: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (GCC) version 4.5.3 (i686-pc-cygwin)
kompilerad med GNU C version 4.5.3, GMP-version 4.3.2, MPFR-version 3.0.1-p4, MPC-version 0.8
GGC heuristik: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
main.f95:2:0: fel: extern länkklass krävs för symbol "myadd" på grund av attributet "dllexport"
main.f95:154:0: fel: extern länkklass krävs för symbol "mypbp" på grund av attributet "dllexport"
So, what am I doing wrong?
Tried to add the option -std=f2003 and got the same error.
Pls advice.
I also want to add that if I remove C(Bind...) and change !GCC$ to !DEC$ I can compile...
I am so utterly confused.
Sincerely Jens