GithubHelp home page GithubHelp logo

Comments (5)

svaarala avatar svaarala commented on June 2, 2024

duk_eval_string() is implemented as a macro in duktape.h. All Duktape functions are potentially implemented as macros and whether an API call is a macro or a function changes from time to time, depending on what's most convenient.

What problem are you encountering in practice?

from duktape.

svaarala avatar svaarala commented on June 2, 2024

As a sidenote: when using Duktape as a .so one important note is that when you include duktape.h in the calling program, you should compile to calling program with the same DUK_OPT_xxx options you use when compiling the Duktape shared library. This is needed because some Duktape options may affect API binary compatibility (rare, but possible).

Of course, if you have no custom options, this is not an issue.

from duktape.

lobingera avatar lobingera commented on June 2, 2024

Thank you.

For the problem in practice:

julia> using Duktape

julia> d = Duktape.duk_create_heap()
duk_context(Ptr{Void} @0x0bc3f740)

julia> Duktape.duk_eval_string(d,"a = 33")
ERROR: ccall: could not find function duk_eval_string in library /home/lobi/juliarepo/duktape-0.11.0/src/duktape.so
 in duk_eval_string at /home/lobi/.julia/v0.3/Duktape/src/Duktape.jl:16

I wasn't aware that the some of the APIs are defined via macro, so i implemented the interface as call to the API name. That obviously fails with duk_eval_string.

from duktape.

svaarala avatar svaarala commented on June 2, 2024

Good point - I'll add a note about being sure to include duktape.h in calling files. Even if a calling program compiles and links, it might use wrong types in the call (the compiler's guess can quite easily be incorrect w.r.t. typing).

I'll reopen this until there's some additional text in the guide.

from duktape.

svaarala avatar svaarala commented on June 2, 2024

This should cover the issues discussed here: aa28c89

from duktape.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.