int64_t problem as function paramter

51 views
Skip to first unread message

linghuye

unread,
Mar 20, 2012, 2:41:46 AM3/20/12
to emscripten-discuss
hi,
Recently I port my company's render engine project to javascript
with emscripten. In the project we use int64_t for id, and I use
USE_TYPED_ARRAYS=2 and I64_MODE=1 for compiling the C++ source code.
The problem is the wrongly compiled javascript code.

Source C++ is like:
A.
class CDataThreadObj{
public:
CDataThreadObj(int64_t id, DWORD uType, const char* pszIndex, DWORD
uExigence) {
// Construct stuffs
}};
B.CDataThreadObj* pAniDataObj = new CDataThreadObj(idAni,
DATA_RES_TYPE_ANI, NULL, dwExigence);

The generated javascript code is:
A. function __ZN14CDataThreadObjC1ExjPKcj($this, $id$0, $id$1, $uType,
$pszIndex, $uExigence) {}
B. var $267=__Znwj(84);
var $268=$267;
var $269=HEAP32[(($idAni)>>2)];
var $270$0=$269;
var $270$1=0;
var $271=$35;
(function() { try { __THREW__ = false; return
__ZN14CDataThreadObjC1ExjPKcj($268, $270, 4, 0, $271) } catch(e)
{} .....

The parameter $270 in __ZN14CDataThreadObjC1ExjPKcj seems wrong, I
guess it should be $270$0, $270$1, so I change it manually then it
runs corrretly.
And I do not find I64_MODE in original settings.js, I add it myself,
but the compile result is still wrong.

I dont want to manually modify these code every time, so, Is there
something wrong with my config in settings.js, or it is a bug in
current emscripten?
Thanks for your replay.

linghuye

Alon Zakai

unread,
Mar 20, 2012, 2:28:23 PM3/20/12
to emscripte...@googlegroups.com
This looks like a bug. However I can't reproduce it here, so it might
depend on the specific command you use to compile or something
else. I tried using the code you provided but I had to fill in some
blanks and maybe that makes a difference.

Can you make a complete concrete testcase (an entire file to compile
and the command to compile it)?

- azakai

linghuye

unread,
Mar 26, 2012, 5:33:34 AM3/26/12
to emscripten-discuss
I check out a new copy of emscripten, recompile the code, find the
code is generated correctly now.
Thanks for your hard work.
Reply all
Reply to author
Forward
0 new messages