- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
!DEC$ ATTRIBUTES DLLEXPORT::ARRAYTEST
double precision n,i,j,m,l
double precision arr(*)
l=16.0
m=log(l)
m=log(n)
m=log(l)
m=log(n)
END SUBROUTINE
VC
#include "windows.h"
#include "stdio.h"
#include "math.h"
#include "stdio.h"
#include "math.h"
void main()
{
{
double a=12;
double output[10];
double output[10];
for(int i=0;i<10;i++)
{
output=i;
}
{
output=i;
}
a=log(a);
HINSTANCE hIns;
hIns = LoadLibraryEx("arraytest.dll",NULL,DONT_RESOLVE_DLL_REFERENCES);
hIns = LoadLibraryEx("arraytest.dll",NULL,DONT_RESOLVE_DLL_REFERENCES);
typedef int (*MYPROC)(double *, double *);
MYPROC func= (MYPROC)GetProcAddress(hIns,MAKEINTRESOURCE(1));
MYPROC func= (MYPROC)GetProcAddress(hIns,MAKEINTRESOURCE(1));
func(&a,output);
}
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 :(

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page