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

SystemAccessViolation in dll

mamey4
Beginner
394 Views
Hi there,

I just read the topic about an internal WRITE in a DLL causing a SystemAccessViolation, and I believe I have a problem that could have the same explanation as the above mentioned one.
I have a code, statically linked to PETSc and MPI, which basically looks like this:

!...some declarations and include statements...
call MPI_Init(err)
open(20, file='d:/test.txt', status='NEW', iostat=stat)
write(20,*) 'test'
close(20)
call MPI_Comm_rank(MPI_COMM_WORLD,i,err)
call PetscInitialize(PETSC_NULL_CHARACTER,err)
call MPI_Finalize(err)

My environment is IVFC11.0.74, VS08 and Win7. When I run the code in a main program, it works fine. If I put it in a dll function and call this function from another program (which is VB.NET, if that's relevant), however, I get a SystemAccessViolation. I can narrow the error down to the PetscInitialize() line, because the code still creates the test.txt file.
I refer to that other forum thread because there I read:

The access violation only happens when linking statically (Multithreaded option for run-time libraries). It does not happen when linking as Multithreaded DLL. So that means we have a work-around, although we would like to see this fixed for the static case.

I don't know is this is relevant for me as well, but I'm very confused about that situation.

Thanks in advance for your thoughts,
Martin
0 Kudos
1 Reply
Steven_L_Intel1
Employee
394 Views
The code snippet you posted does no internal WRITEs, so would not likely be related to the other issue (I am not sure to what you are referring.) At this point you are using an old compiler and we have fixed many issues in the meantime. Please try again with 12.0 (Composer XE 2011) Update 2 and see if the problem persists.
0 Kudos
Reply