mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
cgen,dl: remove workaround in dl
, generate a DllMain() in cgen instead for -shared
on windows (#23961)
This commit is contained in:
parent
ebfa7d86cf
commit
bd2ec679f0
5 changed files with 34 additions and 36 deletions
|
@ -20,25 +20,11 @@ type FN_vcleanup_caller = fn ()
|
|||
// open loads a given module into the address space of the calling process.
|
||||
pub fn open(filename string, flags int) voidptr {
|
||||
res := C.LoadLibrary(filename.to_wide())
|
||||
// Because LoadLibrary has no constructor, this is a workaround
|
||||
if !isnil(res) {
|
||||
vinit_caller := FN_vinit_caller(sym(res, '_vinit_caller'))
|
||||
if !isnil(vinit_caller) {
|
||||
vinit_caller()
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// close frees the loaded a given module.
|
||||
pub fn close(handle voidptr) bool {
|
||||
// Because FreeLibrary has no destructor, this is a workaround
|
||||
if !isnil(handle) {
|
||||
vcleanup_caller := FN_vcleanup_caller(sym(handle, '_vcleanup_caller'))
|
||||
if !isnil(vcleanup_caller) {
|
||||
vcleanup_caller()
|
||||
}
|
||||
}
|
||||
return C.FreeLibrary(handle)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue