Skip to content

Commit

Permalink
NWTC_IO: nullifying DLL (on restart) if not present when packing (#1311)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebranlard authored Nov 3, 2022
1 parent d2c9fef commit 39d37e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/nwtc-library/src/NWTC_Base.f90
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ MODULE NWTC_Base

TYPE DLL_Type

INTEGER(C_INTPTR_T) :: FileAddr !< The address of file FileName. (RETURN value from LoadLibrary ) [Windows]
INTEGER(C_INTPTR_T) :: FileAddr = INT(0,C_INTPTR_T) !< The address of file FileName. (RETURN value from LoadLibrary ) [Windows]
TYPE(C_PTR) :: FileAddrX = C_NULL_PTR !< The address of file FileName. (RETURN value from dlopen ) [Linux]
TYPE(C_FUNPTR) :: ProcAddr(NWTC_MAX_DLL_PROC) = C_NULL_FUNPTR !< The address of procedure ProcName. (RETURN value from GetProcAddress or dlsym) [initialized to Null for pack/unpack]

Expand Down
5 changes: 5 additions & 0 deletions modules/nwtc-library/src/NWTC_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,11 @@ SUBROUTINE DLLTypeUnPack( OutData, ReKiBuf, DbKiBuf, IntKiBuf, ErrStat, ErrMsg )

IF ( IntKiBuf(1) == 1 .AND. LEN_TRIM(OutData%FileName) > 0 .AND. LEN_TRIM(OutData%ProcName(1)) > 0 ) THEN
CALL LoadDynamicLib( OutData, ErrStat, ErrMsg )
else
! Nullifying
OutData%FileAddr = INT(0,C_INTPTR_T)
OutData%FileAddrX = C_NULL_PTR
OutData%ProcAddr = C_NULL_FUNPTR
END IF

END SUBROUTINE DLLTypeUnPack
Expand Down

0 comments on commit 39d37e6

Please sign in to comment.