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.
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)?
On Mon, Mar 19, 2012 at 11:41 PM, linghuye <linghuye...@gmail.com> wrote: > 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.
> 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
> On Mon, Mar 19, 2012 at 11:41 PM, linghuye <linghuye...@gmail.com> wrote:
> > 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.