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

DLL Linked Fortran Application Execution

schwarem
Débutant
1 464 Visites

This is my first time putting together an application and a DLL using the Intel library. I have them both in the same Visual Studio 2005 project. I set the application to be dependent of the dll. Everything compiles fine, but when the application goes to call the function within the DLL I get the following error:

forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
BLUEMAX5.dll 10030E77 Unknown Unknown Unknown

This project previously worked in the old Compaq Fortran Compiler. Am I missing a compiler or linker setting or what?

0 Compliments
4 Réponses
Paul_Curtis
Précieux contributeur I
1 464 Visites

Your code may need to call LoadLibrary and GetProcAddress in order to access functions within the DLL. For example,

[cpp]    INTERFACE
        INTEGER FUNCTION MAPIInitialize (lpMapiInit)
            !DEC$ATTRIBUTES STDCALL:: MAPIInitialize
            INTEGER lpMapiInit
        END FUNCTION
    END INTERFACE
    POINTER(lpMAPIInitialize,MAPIInitialize)

and then, later on,

        hMapiLib = LoadLibrary("mapi32.dll"C)
        IF (hMapiLib /= 0) THEN
             lpMAPIInitialize= GetProcAddress(hMapiLib,"MAPIInitialize"C)[/cpp]

0 Compliments
Steven_L_Intel1
Employé
1 464 Visites

Did you completely rebuild all objects that were compiled with CVF? At what statement in the program does the error occur?

I don't think dynamic loading is the answer for you - it is probably something simple.

0 Compliments
schwarem
Débutant
1 464 Visites

Did you completely rebuild all objects that were compiled with CVF? At what statement in the program does the error occur?

I don't think dynamic loading is the answer for you - it is probably something simple.

I completely rebuilt everything. Here is the code in the main application. It fails at the line where it calls BMInit, which is the first function within the DLL. This is the exact same code that worked with the old Compaq Fortran.

CALL GETARG(1, DIRPATHS)

CALL GETARG(2, SCNFILE )

DFTIME = 0.01D0

CALL BMINIT

STOP


END

0 Compliments
Steven_L_Intel1
Employé
1 464 Visites

I think we're going to need to see your project, and this should be handled through Intel Premier Support. Please open an issue there and attach a ZIP of your project(s) with all files needed to build and run the application.

0 Compliments
Répondre