Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29234 Discussions

LOG(16) cause exception when VC calling CVF DLL??

zhangqi001213
Beginner
607 Views
I wrote a fortran dll with compaq visual fortran V6.5 then call the fortran dll with visual C++ 6.0.I found that if therewas a log function in the fortran dll, when VC calls it, some unhandled exception will occur.
can anybody provide some suggestion?? Thanks!!
my code:
CVF:
SUBROUTINE ARRAYTEST(n,arr)
!DEC$ ATTRIBUTES DLLEXPORT::ARRAYTEST
double precision n,i,j,m,l
double precision arr(*)
l=16.0
m=log(l)
m=log(n)
END SUBROUTINE
VC
#include "windows.h"
#include "stdio.h"
#include "math.h"
void main()
{
double a=12;
double output[10];
for(int i=0;i<10;i++)
{
output=i;
}

a=log(a);
HINSTANCE hIns;
hIns = LoadLibraryEx("arraytest.dll",NULL,DONT_RESOLVE_DLL_REFERENCES);
typedef int (*MYPROC)(double *, double *);
MYPROC func= (MYPROC)GetProcAddress(hIns,MAKEINTRESOURCE(1));

func(&a,output);

}

0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
607 Views

Huh -- why DONT_RESOLVE_DLL_REFERENCES? If the dll is linked with DFORRT.dll (which is the default), it won't get loaded, and I can imagine the crash. Why not plain LoadLibrary?

Jugoslav

0 Kudos
zhangqi001213
Beginner
607 Views

yeah, it works. Thanks.

Today on my way to the lab, I was just thinking about the possibility thatDONT_RESOLVE_DLL_REFERENCES may mess things up andI should try this.ThenI won't know why it works.

Actually, till now, I still don't understand why :(

0 Kudos
Reply