typedef int (*MYPROC)(int &n, double bR,double bM,double cR,double cM,double dR,double dM);
// TODO: Add your control notification handler code here
hIns = LoadLibraryEx(_T("F:\\practise\\DFLL\\DFLL\\Debug\\DFLL.dll"),NULL,DONT_RESOLVE_DLL_REFERENCES);
MYPROC fun= (MYPROC)GetProcAddress(hIns,"DFLL");
for(unsigned long i=0;i<3;i++)
for(unsigned long j=0;j<3;j++)
int n = 3;
The Client is:
USE mkl95_PRECISION, ONLY: WP =>DP
USE mkl95_LAPACK, ONLY: GEEVX
! Expose subroutine DFLL to users of this DLL
! Body of DFLL
! The following directive exports the routine and sets the global name
!DEC$ ATTRIBUTES DLLEXPORT::DFLL
INTEGER(4) ILO, IHI
complex(WP) :: ABNRM
! do j=1,3
! end do
CALL GEEVX(BZ,CZ,DZ,EZ,'V',ILO, IHI)
end subroutine DFLL
when i debug the dll,I find it will be cruped when i call geevx procedure. I don't kown why.
This is my first chance to uses dllmadewith fortran, Then i have to use lapacke interface for c++,
It's fluently, there is no problem to make the dll.
I doubt that the problem just be triggered by an option with compiling.
Than you for your help!
call geevx(a, w [,vl] [,vr] [,balanc] [,ilo] [,ihi] [,scale] [,abnrm] [,rconde] [, rcondv] [,info])
CHARACTER*1. Must be 'N', 'P', 'S', or 'B'. Indicates how the input matrix should be diagonally scaled and/or permuted to improve the conditioning of its eigenvalues.
If balanc = 'N', do not diagonally scale or permute;
If balanc = 'P', perform permutations to make the matrix more nearly upper triangular. Do not diagonally scale;
If balanc = 'S', diagonally scale the matrix, i.e. replace A by D*A*inv(D), where D is a diagonal matrix chosen to make the rows and columns of A more equal in norm. Do not permute;
If balanc = 'B', both diagonally scale and permute A.
Computed reciprocal condition numbers will be for the matrix after balancing and/or permuting. Permuting does not change condition numbers (in exact arithmetic), but balancing does.
In other words, this parameter can take values 'N','P','S','B' but not 'V'.
Probably you misinterpreted it with JOBV[L/R] parameters which are not needed in F95 - presence of respective argument VL or VR actually means that the parameter is 'V'.
Thank you for your help!
I tried again with the parameter 'P' .'N' .'S' and'B',but failed, I don't understand why the lapacke interface is right with the same parameters. I read the mkl document again,but steer can't find the problem,Can you give me the code fragment calling the geevx in the dll? I have tried it in execution files(.exe) ,It works perfect.But if you use it in dll ,the host will be crashed.
All Thankes do to our developersas they actually rootcaused the issue and the resolution is the following:
1) Instead of
hIns = LoadLibraryEx(_T("..\\DFLL\\debug\\DFLL.dll"),NULL,DONT_RESOLVE_DLL_REFERENCES);
in source file TestLapack.cpp please use
hIns = LoadLibrary(_T("..\\DFLL\\debug\\DFLL.dll"));
with the correct indication of the way to the library;
this correction is the direct sequence of the description
where the item about DONT_RESOLVE_DLL_REFERENCES has NoteDo not use this value;
If this value is used, and the executable module is a DLL, the system does not call DllMain for process and thread initialization and termination. Also, the system does not load additional executable modules that are referenced by the specified module.
NoteDo not use this value; it is provided only for backward compatibility. If you are planning to access only data or resources in the DLL, use LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE or LOAD_LIBRARY_AS_IMAGE_RESOURCE or both. Otherwise, load the library as a DLL or executable module using the LoadLibrary function.
2) Optional, if yourproject can't founddependency libraries.
In TestLapack Project Properties -> Debugging -> Environmentyou may need make sure PATH=c:\program files (x86)\INTEL\COMPOSERXE-2011\REDIST\ia32\compiler (the path to where libifcoremdd.dll is) because DFLL.dll is dependent on libifcoremdd.dll as dumpbin /DEPENDENTS command on DFLL.lib tells.
After these two corrections, TestLapack project runs well.
Please try these corrections at your side and let us know the results to be happy :)
I attached the fix project.