From b00d44c201e46711bfbbe6011490f686053fcf4d Mon Sep 17 00:00:00 2001 From: Julius Preuschoff <76872934+Plutoniumdrache@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:35:38 +0200 Subject: [PATCH] fix input file name bug --- WRAPPER/src/WRAPPER.f90 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/WRAPPER/src/WRAPPER.f90 b/WRAPPER/src/WRAPPER.f90 index babf5d2..b3ec193 100644 --- a/WRAPPER/src/WRAPPER.f90 +++ b/WRAPPER/src/WRAPPER.f90 @@ -41,7 +41,9 @@ SUBROUTINE DISCON(avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG) BIND (C, NAME CHARACTER(SIZE(avcMSG)-1) :: ErrMsg ! a Fortran version of the C string argument (not considered an array here) [subtract 1 for the C null-character] INTEGER(4) :: iDLL ! Counter INTEGER(HANDLE) :: FileAddr ! The address of file FileName. (RETURN value from LoadLibrary in kernel32.f90) -INTEGER(LPVOID) :: ProcAddr ! The address of procedure ProcName. (RETURN value from GetProcAddress in kernel32.f90) +INTEGER(LPVOID) :: ProcAddr ! The address of procedure ProcName. (RETURN value from GetProcAddress in kernel32.f90) +CHARACTER(1024) :: SubDLLInputFile ! Name of the input file for the sub-DLL (.IN) +INTEGER(4) :: SubDLLInputLen ! Number of characters of the name of the .IN file. TYPE(LidarVariables), SAVE :: LidarVar ! lidar related variable type TYPE(LidarErrorVariables), SAVE :: ErrVar ! lidar related error type @@ -93,6 +95,13 @@ END SUBROUTINE BladedDLL_Legacy_Procedure RETURN ELSE ! if the address is correctly associated, then we can run the DLL CALL C_F_PROCPOINTER(LidarVar%PROCADDR(iDLL), DLL_Legacy_Subroutine) + + ! The following 4 lines fix the bug that no IN file names are supported that are shorter than the IN file name of the WRAPPER itself. + SubDLLInputFile = '' + SubDLLInputFile = TRIM(LidarVar%DLLINPUTFILENAME(iDLL)) // C_NULL_CHAR + SubDLLInputLen = LEN_TRIM(LidarVar%DLLINPUTFILENAME(iDLL)) + 1 + avrSWAP(50) = REAL(SubDLLInputLen, C_FLOAT) + CALL DLL_Legacy_Subroutine (avrSWAP, aviFAIL, TRIM(LidarVar%DLLINPUTFILENAME(iDLL))//C_NULL_CHAR, avcOUTNAME, avcMSG ) END IF END DO