Skip to content

Commit 64a5f87

Browse files
rednebBodigrim
authored andcommitted
do not use capi for dlfcn.h stuff under wasm-wasi
1 parent e7ff902 commit 64a5f87

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

System/Posix/DynamicLinker/Prim.hsc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,17 @@ data RTLDFlags
8585
| RTLD_LOCAL
8686
deriving (Show, Read)
8787

88+
#if defined(HAVE_DLFCN_H)
8889
foreign import capi unsafe "dlfcn.h dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())
8990
foreign import capi unsafe "dlfcn.h dlsym" c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
9091
foreign import capi unsafe "dlfcn.h dlerror" c_dlerror :: IO CString
9192
foreign import capi unsafe "dlfcn.h dlclose" c_dlclose :: (Ptr ()) -> IO CInt
93+
#else
94+
foreign import ccall unsafe "dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())
95+
foreign import ccall unsafe "dlsym" c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
96+
foreign import ccall unsafe "dlerror" c_dlerror :: IO CString
97+
foreign import ccall unsafe "dlclose" c_dlclose :: (Ptr ()) -> IO CInt
98+
#endif // HAVE_DLFCN_H
9299

93100
packRTLDFlags :: [RTLDFlags] -> CInt
94101
packRTLDFlags flags = foldl (\ s f -> (packRTLDFlag f) .|. s) 0 flags

0 commit comments

Comments
 (0)