本帖最後由 LoneGumMan 於 2013-4-5 00:01 編輯
.Net CLR 設計O既其中一個criteria係可以同native platform interop. Java 都有 JNI.
因為C 基本上有一個全世界都理解同埋同意左O既 calling convention, call native code 唔係咁大不了. 只要 GEN 到o岩O既function setup, jmp 到O岩O既address, 下一個 instruction 就係native code, return 返黎, 睇得明個 memory layout, 恭喜晒, 你 call 左native function!
要記住一樣野, pointer 真係唔係咁大不了, 佢只係一個 address. pointer to pointer, pointer to pointer to pointer ... etc 說穿了其實都係同一個mechanism,只不過多左 n 咁多個 level of indirection. 仲有function pointer, memory function pointer ... 唔好俾佢地嚇怕. |