我使用嵌入式 JavaScript 引擎,我曾经将结果fopen()
作为数字传递给 JS 代码。
int numeric_handle = (int)fopen(*P1, "rb");
return Number::New(numeric_handle); // Return to JavaScript
但是现在我需要在 64 位系统中重新编译,我得到了
fatal error: cast from pointer to smaller type 'int' loses information
现在我有点卡住了,我如何保持我的系统设计但尽可能少地更改代码?我正在考虑拥有一个哈希映射,一个包含 FILE* 并在该数组中返回一个 ID 的数组。但这将意味着额外的内存管理,额外的查找。