Rust + Windows ã§ã¦ã£ã³ãã¦ã¿ã¤ãã«ã¨ãã¨ã£ã¦ã¿ã
ãªã«ãã¦ããã
社ä¼äººçæ´»4å¹´ç®ã§ãWindows ã«æã¾ããã£ã¦ãã¾ãã¾ãã・・・
ShellScript 㧠GCC ãã«ãããã¦ãããã®é ã«ã¯ãã・・・
ãã¦
Rust ããã®ãã触ã£ã¦ã¾ãã
ã§ãWindows ã§ã API ãã¡ããã£ã¨ãã£ãã®ã§ã試ãã«ãã£ã¦ã¿ã¾ããã
ã§ãåçã« ãã¼ ã¨æã£ãã®ãããã®é¨åã
let mut title = vec![ 0u16; (length + 1) as usize ]; unsafe { user32::GetWindowTextW(whdl, title.as_mut_ptr(), length + 1); }
unsafe ä½ã¦ãããã malloc/free ãªã®ããªã¼ãªãã¦æã£ã¦ããã§ãããããã£ã¨ç¢ºä¿åºæ¥ã¾ããã
è¨ããã¦ã¿ãã°ããããã«ãªã¼ãé åºãã£ãã
mut vec!
ã® as_mut_ptr()
ãè¿ãã°ãå¤æ´å¯è½ãªã¡ã¢ãªé åã§ããã
åã¿ãã㪠API ã¹ãã¹ã触ã人éã«ã¯ãããããéãã§ãã
ã¤ãã¼
æ§é ä½ããµã³ãã«ã®å²å¦è
ãããã§ããæ¸ãã¦ãªãã®ã§ãããããã¡ããã¨æ¸ãã¾ãã
trait ã¨ããã¾ã ã
æ§é ä½é
åãã¨ã£ã¦ãã¦ã¨ããé¢ç½ããã§ããã
Lifetime? HAHAHA!