- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi
I have a static lib containing 12 subroutines,called by 8 applications (no app calls all
12 subs).
Now I transformed it from static to dll by inserting in it the !DEC$ ATTRIBUTES DLLEXPORT.
Also inserted !DEC$ ATTRIBUTES DLLIMPORT in the calling programs.
I have not used an INTERFACE because in some of the dll samples it was not used.
The dll was buit with no error, and a program that uses one of its sub was also rebuilt ok.
This program now has a problem:
The sub it calls fills an allocatable array declared in a module, but the calling
program has no access to this array (in debugging it shows as undefined).
Why? With the static lib it worked fine.
Also, in the static lib the file used by this sub was opened in the calling program,
and in the dll I had to open it in the sub. Why?
Below are the module, part of the codes of this sub and of the calling program.
I am using CVF Professional edition 6.6B
Thanks for any help.
Geraldo
MODULE MODGERAL
INTEGER*4, ALLOCATABLE,SAVE :: INDA(:,:) ! NOT SHURE SAVE IS NECESSARY
INTEGER*4 NUMANTENAS
END MODULE MODGERAL
SUBROUTINE SUBINDA ! one of the subs contained in the dll
!DEC$ ATTRIBUTES DLLEXPORT :: SUBINDA
USE MODGERAL
.
.
OPEN(UNIT=8,FILE='C:APROJANTENAANTSHF.ANT',FORM='FORMATTED')
NUMANTENAS=0
111 READ(8,*,END=222)
NUMANTENAS=NUMANTENAS+1
GOTO 111
222 ALLOCATE(INDA(NUMANTENAS,7))
! FILLS THE ARRAY INDA
.
END SUBROUTINE SUBINDA
PROGRAM PMP
!DEC$ ATTRIBUTES DLLIMPORT :: SUBINDA
USE MODGERAL
USE MODPM
.
.
CALL SUBINDA
.
.
DO LI=1,NUMANTENAS,1
WRITE(ANTE,86)(INDA(LI,J),J=3,5) ! in debug INDA is undefined
86 FORMAT(3A4)
.
.
END PROGRAM
I have a static lib containing 12 subroutines,called by 8 applications (no app calls all
12 subs).
Now I transformed it from static to dll by inserting in it the !DEC$ ATTRIBUTES DLLEXPORT.
Also inserted !DEC$ ATTRIBUTES DLLIMPORT in the calling programs.
I have not used an INTERFACE because in some of the dll samples it was not used.
The dll was buit with no error, and a program that uses one of its sub was also rebuilt ok.
This program now has a problem:
The sub it calls fills an allocatable array declared in a module, but the calling
program has no access to this array (in debugging it shows as undefined).
Why? With the static lib it worked fine.
Also, in the static lib the file used by this sub was opened in the calling program,
and in the dll I had to open it in the sub. Why?
Below are the module, part of the codes of this sub and of the calling program.
I am using CVF Professional edition 6.6B
Thanks for any help.
Geraldo
MODULE MODGERAL
INTEGER*4, ALLOCATABLE,SAVE :: INDA(:,:) ! NOT SHURE SAVE IS NECESSARY
INTEGER*4 NUMANTENAS
END MODULE MODGERAL
SUBROUTINE SUBINDA ! one of the subs contained in the dll
!DEC$ ATTRIBUTES DLLEXPORT :: SUBINDA
USE MODGERAL
.
.
OPEN(UNIT=8,FILE='C:APROJANTENAANTSHF.ANT',FORM='FORMATTED')
NUMANTENAS=0
111 READ(8,*,END=222)
NUMANTENAS=NUMANTENAS+1
GOTO 111
222 ALLOCATE(INDA(NUMANTENAS,7))
! FILLS THE ARRAY INDA
.
END SUBROUTINE SUBINDA
PROGRAM PMP
!DEC$ ATTRIBUTES DLLIMPORT :: SUBINDA
USE MODGERAL
USE MODPM
.
.
CALL SUBINDA
.
.
DO LI=1,NUMANTENAS,1
WRITE(ANTE,86)(INDA(LI,J),J=3,5) ! in debug INDA is undefined
86 FORMAT(3A4)
.
.
END PROGRAM
Link kopiert
0 Antworten

Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite