Dear People of Intel Comunity :
I cal my dll from VB 6. by first time and it run fine, but when I call it by second time inside the same procedure it crash, my dll is linked with a several libs (4) compiled with IVF too. Could be problem with the arrays at the beginning of the program, my VF code is:
subroutine Dll9(Aext,Mext,d,v,
& maxn,maxnev,maxncv,maxbdw,lda,ldv,n,nev,ncv,info)
! Expose subroutine Dll9 to users of this DLL
!DEC$ ATTRIBUTES DLLEXPORT,STDCALL,REFERENCE,ALIAS:'Lanczos3'::Dll9
!DEC$ ATTRIBUTES REFERENCE ::Aext,Mext,d,v
!DE C$ ATTRIBUTES REFERENCE ::maxn,maxnev,maxncv,maxbdw,lda,ldv,n,nev,ncv,info
! Variables
c %-------------------------------------%
c | Define leading dimensions for all |
c | arrays. |
c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer(2) maxn,maxnev,maxncv,maxbdw,lda,ldv,n,nev,ncv,info
integer lworkl, idime, inode
integer ku, kl, j, ido,
& isub, isup, idiag, maxitr, mode, nconv,I,I1,
& K, Mbanda,I2
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn),pro(maxn)
real(8) Mext(maxn,maxn),Aext(maxn,maxn)
character which*2, bmat
Double precision
& tol, h, sigma, r1, r2
logical rvec
Double precision
& one, zero, two, four, six
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
& four = 4.0D+0 , six = 6.0D+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
&& nbsp; dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
Fortan command line:
/nologo /Zi /Od /module:"$(INTDIR)/" /object:"$(INTDIR)/" /traceback /check:bounds
/libs:dll /threads /dbglibs /c
Linker command line:
/OUT:"Debug/Dll9.dll" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"D:Basura2Dll9Dll9debugdll9.dll.intermediate.manifest" /DEBUG /PDB:"Debug/Dll9.pdb" /ASSEMBLYDEBUG /SUBSYSTEM:WINDOWS /IMPLIB:"$(OUTDIR)/Dll9.lib" /DLL util.lib lapack.lib blas.lib src.lib
Thanks for all.
链接已复制
This is mi VB 6. code.
Declare Sub Lanczos3 Lib "D:Basura2Dll9Dll9Debugdll9.dll" (ByRef Aext As Double, ByRef Mext As Double, ByRef df As Double, ByRef vf As Double, _
ByRef maxn As Integer, ByRef maxnev As Integer, ByRef maxncv As Integer, ByRef maxbdw As Integer, ByRef LDA As Integer, ByRef ldv As Integer, _
ByRef Ns As Integer, ByRef nev As Integer, ByRef ncv As Integer, ByRef info As Integer)
Dim K1ss(1 To 4, 1 To 4) As Double, M1ss(1 To 4, 1 To 4) As Double
Dim D(1 To 4, 1 To 2) As Double, v(1 To 4, 1 To 4) As Double
K1ss(1, 1) = 39: K1ss(1, 2) = -9: K1ss(1, 3) = 21: K1ss(1, 4) = -11
K1ss(2, 1) = -9: K1ss(2, 2) = 39: K1ss(2, 3) = -11: K1ss(2, 4) = 21
K1ss(3, 1) = 21: K1ss(3, 2) = -11: K1ss(3, 3) = 39: K1ss(3, 4) = -9
K1ss(4, 1) = -11: K1ss(4, 2) = 21: K1ss(4, 3) = -9: K1ss(4, 4) = 39
For IDIME = 1 To 4
For INODE = 1 To 4
M1ss(IDIME, INODE) = 0#
Next INODE
Next IDIME
For IDIME = 1 To 4
M1ss(IDIME, IDIME) = 1#
; For INODE = 1 To 4
K1ss(IDIME, INODE) = K1ss(IDIME, INODE) / 80#
Next INODE
Next IDIME
maxn = 4: maxnev = 4: maxncv = 4: maxbdw = 50
nev = 3: ncv = 4:lda = maxbdw: ldv = maxn: M = 4: Ns = 4
Call Lanczos3(K1ss(1, 1), M1ss(1, 1), D(1, 1), v(1, 1), maxn _
, maxnev, maxncv, maxbdw, lda, ldv, Ns, nev, ncv, info)
