Ask coding questions

← Back to all posts
Why am I Getting an Illegal Signature Function Call Within JavaScript?
[deleted]

Once I call my function called "main," from /script.js, I get an error, why?
The code seems perfectly valid, in every single way.

Answered by fuzzyastrocat [earned 5 cycles]
View Answer
Comments
hotnewtop
fuzzyastrocat

Sorry that my previous answer did not address the issue, I clearly misinterpreted the question.

However, perhaps this can be of some help. According to this github issue, it appears that importing an i64 from wasm into JS isn't possible. It's a little old, but it might still be relevant since as far as I know JS doesn't have native support for int64's yet.

Perhaps try changing the i64's into i32's, and see if the issue goes away?

[deleted]

@fuzzyastrocat Thank you for acknowledging the problem at hand, I can try changing it, but from I know, i64s are supposed to map directly to JavaScript BigInts, and it appears that Firefox handles it properly.

[deleted]

@fuzzyastrocat And it appears that browser support for i64 => BigInt isn't that great.. thank you for your time! Now to do some wacky stuff with this.

fuzzyastrocat

@JadenGarcia Great, glad to hear you've got it working!

RohilPatel

i get the err too

[deleted]

@RohilPatel Chromium browser? I think it's only Chromium that is bugging out... I'm too close to the bleeding edge I think.

RohilPatel
[deleted]

@RohilPatel Just to ask, you don't happen to have ever met anyone on Rep who used similar technologies to that which I am using right now on that web page, have you?

Coder100

I don't see any error...

[deleted]

@Coder100 Umm... that's not good, what browser?

Coder100
Coder100

I think it got resolved, I don't see anything wrong @JadenGarcia

[deleted]

@Coder100 Something tells me the code isn't running at all then :/

[deleted]

@Coder100 It definitely isn't working for me, the writer of the code, so... I can't quite say the same.
Does it log anything into the console?

Coder100
Coder100
Coder100

but why are you making them alert please don't @JadenGarcia

[deleted]

@Coder100 I just checked my source, and my math seems weirdly wrong... I think I'll recompile it later today and fix the file so it'll work on other browsers.

[deleted]

@Coder100 Okay okay, I hate it too and normally don't, but I'm on an administered computer that disables access to the browser console, so it's the only way I can read the errors at all.

Coder100

@JadenGarcia oh ok, make sure to also add the line number too

PattanAhmed

@JadenGarcia Hi,
It clearly says:-

Check this example and let this example fit in a place something that fits in your code somewhere where BigInt is converted to a Number

Reference

That's it
Thanks!

Hope this helps

[deleted]

@PattanAhmed Odd, I was getting this instead:

PattanAhmed

@JadenGarcia LoL!
Now, This is a weird error!
Check this website, instead.
https://github.com/emscripten-core/emsdk/issues/476

[deleted]

@PattanAhmed I didn't use emscripten, so that's not of much help, I wrote the .wat myself; the only thing I used was wat2wasm.

PattanAhmed

@JadenGarcia Oh!
Sorry to say, I can't help you a lot with this error because I get something else here.

[deleted]

@PattanAhmed Yeah, there was in fact a BigInt error, but that would only occur if the function was called, which I couldn't get to happen. It seems like that means it was properly ran for you, what browser are you using?

[deleted]

@PattanAhmed I think there was a null character in the eval, can you check whether or not I fixed it right now?

PattanAhmed

@JadenGarcia I am using Firefox!

PattanAhmed

@JadenGarcia It probably ran well sometimes and some times this may error may come

[deleted]

@PattanAhmed That means it ran perfectly, I need to handle that soon, I'll be back in a few hours, ~2.

PattanAhmed

@JadenGarcia Yes, Of course.
I will wait until 2 hours!

[deleted]

@PattanAhmed @Coder100 Yeah, I'm sorry I had to wait to update it, I was doing stuff irl that forced me away, but I'll speedily update it right away now that I'm back!

PattanAhmed
[deleted]

@PattanAhmed Updated, it should log the string before throwing the syntax error, can you confirm?

PattanAhmed

@JadenGarcia

WHOALA 🚀

It just works fine.
I can confirm

PattanAhmed

@JadenGarcia Need any more help?

[deleted]

@PattanAhmed I know I've asked for quite a lot, but can I get a screenshot of the console or something to confirm that it's working as intended?

PattanAhmed

@JadenGarcia Here is the screenshot:-

[deleted]

@PattanAhmed Dang, it worked flawlessly... now how do we get rid of this signature error :/ .

Coder100

cool so what is the err now @JadenGarcia

[deleted]

@Coder100 Still the illegal signature, do you get an error now that it was updated?

Coder100

oh, instance...
how about doing something like having:

and then doing console.log(Object.keys(data))
@JadenGarcia

Coder100

i get a new one about instance @JadenGarcia

[deleted]

@Coder100 Oh, I was just moving stuff around, refresh it, calling main is the error, yet it's a valid function.

PattanAhmed

@JadenGarcia LoL!
Is it solved?

[deleted]

@PattanAhmed Technically the primary problem I came asking about is still unresolved, if anything, due to browser cross-copatability.

PattanAhmed

@JadenGarcia Yes!
But we can't help you with that?

😢

We have tried all the best we could.

[deleted]

@PattanAhmed RIP, I guess this error will just have to be left open until someone familiar with this comes along. But thank you for your time.

PattanAhmed

@JadenGarcia Yes...
That's the last decision to make now :(