J'ai une DLL écrite en fortran que je connais parce que je la récupère d'un logiciel que nous utilisons tous les jours. J'essaye de l'appeler de n'importe quoi mais j'ai des problèmes je crois avec passer les arguments correctement formatés dans et hors de lui, ainsi j'ai décidé d'essayer et d'y accéder d'un programme de VB. J'ai choisi VB parce que j'ai contacté le développeur du logiciel que nous utilisons et il m'a donné son appel de fonction DLL en VB6, même s'il n'est pas autorisé à me montrer la source FORTRAN.Pourquoi ai-je des problèmes pour passer des arguments depuis ou vers une DLL FORTRAN à partir de VB.NET?
Le problème est (peut-être, je pense) que j'écris dans VB.NET, qui a différents types de données que VB6. Quelqu'un peut-il voir pourquoi j'ai des problèmes. L'erreur que je reçois lors de l'exécution est la suivante: "AccessViolationException n'a pas été gérée: Tentative de lecture ou d'écriture de la mémoire protégée, ce qui indique souvent qu'une autre mémoire est corrompue."
Voici l'appel de fonction i fournie avec:
Declare Sub FCC_Curves Lib "FCC_Curves.dll" (Read_Flag As Boolean, First_Flag As Boolean, Frequency_MHz As Single, IQT As Integer, ByVal Radiation_Opt As String, ByVal L1 As Long, ERP_Watts As Single, T_PowerWatts As Single, Tx_GaindBi As Single, T_Loss As Single, ByVal Service As String, ByVal L2 As Long, Reliability As Integer, ByVal FCC_CurvesDataPath As String, ByVal L3 As Long, ByVal TerrainRoughness As String, ByVal L4 As Long, Haatm As Single, NPRfl As Integer, NFCCCurve As Integer, HPRfl As Single, Crve As Single, FCC_Loss As Single, Code As Integer, FS As Single)
et voici mon code:
Module Module1
Declare Sub FCC_Curves Lib "FCC_Curves.dll" (ByVal Read_Flag As Boolean, ByVal First_Flag As Boolean, ByVal Frequency_MHz As Single, ByVal IQT As Int16, ByVal Radiation_Opt As String, ByVal L1 As Int32, ByVal ERP_Watts As Single, ByVal T_PowerWatts As Single, ByVal Tx_GaindBi As Single, ByVal T_Loss As Single, ByVal Service As String, ByVal L2 As Int32, ByVal Reliability As Int16, ByVal FCC_CurvesDataPath As String, ByVal L3 As Int32, ByVal TerrainRoughness As String, ByVal L4 As Int32, ByVal Haatm As Single, ByVal NPRfl As Int16, ByVal NFCCCurve As Int16, ByVal HPRfl() As Single, ByVal Crve() As Single, ByRef FCC_Loss As Single, ByRef Code As Int16, ByRef FS() As Single)
Sub Main()
Dim Read_Flag As Boolean
Dim First_Flag As Boolean
Dim Frequency_MHz As Single
Dim IQT As Int16
Dim Radiation_Opt As String
Dim L1 As Int32
Dim ERP_Watts As Single
Dim T_PowerWatts As Single
Dim Tx_GaindBi As Single
Dim T_Loss As Single
Dim Service As String
Dim L2 As Int32
Dim Reliability As Int16
Dim FCC_CurvesDataPath As String
Dim L3 As Int32
Dim TerrainRoughness As String
Dim L4 As Int32
Dim Haatm As Single
Dim NPRfl As Int16
Dim NFCCCurve As Int16
Dim HPRfl(12) As Single
Dim Crve(5) As Single
Dim FCC_Loss As Single
Dim Code As Int16
Dim FS(15) As Single
'Dim HPRfl As Single
'Dim Crve As Single
'Dim FCC_Loss As Single
'Dim Code As Int16
'Dim FS As Single
Read_Flag = True
First_Flag = True
Frequency_MHz = 98.1
IQT = 0
Radiation_Opt = "ERP"
L1 = 3
ERP_Watts = 1000
T_PowerWatts = 1000
Tx_GaindBi = 2.15
T_Loss = 0
Service = "Broadcast"
L2 = 9
Reliability = 50
FCC_CurvesDataPath = "C:\Program Files\CSPT_Extension\data\"
L3 = 37
TerrainRoughness = "Off"
L4 = 3
Haatm = 1500
NPRfl = 13
NFCCCurve = 6
Dim i As Int16
HPRfl(0) = 11
HPRfl(1) = 128
For i = 2 To 12
HPRfl(i) = 1500
Next
For i = 0 To 5
Crve(i) = i * 15
Next
FCC_Curves(Read_Flag, First_Flag, Frequency_MHz, IQT, Radiation_Opt, L1, ERP_Watts, T_PowerWatts, Tx_GaindBi, T_Loss, Service, L2, Reliability, FCC_CurvesDataPath, L3, TerrainRoughness, L4, Haatm, NPRfl, NFCCCurve, HPRfl, Crve, FCC_Loss, Code, FS)
End Sub
End Module
+1. Exactement raison, bat moi moi! – MarkJ