4 use shims::posix::dlsym as posix;
5 use shims::windows::dlsym as windows;
7 #[derive(Debug, Copy, Clone)]
8 #[allow(non_camel_case_types)]
11 Windows(windows::Dlsym),
15 // Returns an error for unsupported symbols, and None if this symbol
16 // should become a NULL pointer (pretend it does not exist).
17 pub fn from_str(name: &[u8], target_os: &str) -> InterpResult<'static, Option<Dlsym>> {
18 let name = &*String::from_utf8_lossy(name);
20 "linux" | "macos" => posix::Dlsym::from_str(name, target_os)?.map(Dlsym::Posix),
21 "windows" => windows::Dlsym::from_str(name)?.map(Dlsym::Windows),
22 os => bug!("dlsym not implemented for target_os {}", os),
27 impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
28 pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
32 args: &[OpTy<'tcx, Tag>],
33 ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
34 ) -> InterpResult<'tcx> {
35 let this = self.eval_context_mut();
37 Dlsym::Posix(dlsym) => posix::EvalContextExt::call_dlsym(this, dlsym, args, ret),
38 Dlsym::Windows(dlsym) => windows::EvalContextExt::call_dlsym(this, dlsym, args, ret),