static FOPEN_PATCH: LazyLock<
    Arc<Mutex<Option<Box<dyn FnMut(&CStr) -> Option<CString> + Send + Sync>>>>,
> = LazyLock::new(|| Arc::new(Mutex::new(None)));


후킹하려고 해서 전역변수 사용이 불가피한 상황임. 저 시그니처가 정말 맞나 일단 첫번째 의문. 너무 길어……


    let s = FOPEN_PATCH.clone();
        let mut s = s.lock().unwrap();
        s.replace(Box::new(fopen_patcher));
error[E0310]: the parameter type `F` may not live long enough
    |
102 |         s.replace(Box::new(fopen_patcher));
    |                   ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `F` will meet its required lifetime bounds
    |
help: consider adding an explicit lifetime bound...
    |
98  |         F: FnMut(&CStr) -> Option<CString> + Send + Sync + 'static,
    |                                                          +++++++++


그러고 클로저를 대입하려고 하면 'static 지정을 하라고 함. 근데 일반적인 클로저가 저 수명을 가질 수 있나?


ChatGPT도 여기까지 오니까 다른 소스를 모르겠는지 쳇바퀴를 반복했음. 내 코드가지고 학습하지 않았기만을 바랄 뿐임.