svaarala / duktape

Duktape - embeddable Javascript engine with a focus on portability and compact footprint
MIT License
5.96k stars 516 forks source link

Print undefined #1167

Closed AndreyArsov closed 7 years ago

AndreyArsov commented 7 years ago

Using the following build

I get the error that print is undefined as follows:

Attached to duktape debugger. Exception thrown @C:\code\duktape\dist-files\mandel.js:45: ReferenceError: identifier 'print' undefined Exception thrown @C:\code\duktape\dist-files\mandel.js:52: ReferenceError: identifier 'print' undefined Disconnected: Target detached: ( 0 )

Is this a normal behavior? I see that the hello sample provides native_print api. From the documentation it follows that print should be available, but probably I have messed up the compile options.

Can anyone clarify?

svaarala commented 7 years ago

print() is no longer automatically provided in master because it had portability issues (namely an assumption on I/O and printf()) and retargetability issues (redirecting it to a different place).

Duktape.org still documents Duktape 1.x which provides print().

svaarala commented 7 years ago

Here are replacements for the bindings that you can include in your build:

AndreyArsov commented 7 years ago

Thanks, Sami.