Skip to content

Commit

Permalink
Fix dlclose and tests (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
kivutar authored Nov 12, 2021
1 parent 038765b commit 6cefe03
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ func Test_coreLoad(t *testing.T) {
}
})

state.Core.UnloadGame()
state.Core.Deinit()
Unload()
state.GamePath = ""
state.Verbose = false
}
Expand Down
1 change: 1 addition & 0 deletions libretro/libretro.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ func (core *Core) Deinit() {
inputState = nil
log = nil
getTimeUsec = nil
core.DlClose()
}

// Run runs the game for one video frame.
Expand Down
6 changes: 6 additions & 0 deletions libretro/libretro_notwindows.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ func DlOpen(path string) (unsafe.Pointer, error) {
}
return h, nil
}

// DlClose closes a dynamic library
func (core *Core) DlClose() {
C.dlclose(core.handle)
}

6 changes: 6 additions & 0 deletions libretro/libretro_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ func (core *Core) DlSym(name string) unsafe.Pointer {
func DlOpen(path string) (*syscall.DLL, error) {
return syscall.LoadDLL(path)
}

// DlClose closes a dynamic library
func (core *Core) DlClose() {
core.handle.Release()
}

0 comments on commit 6cefe03

Please sign in to comment.