Giter Club home page Giter Club logo

Comments (4)

floooh avatar floooh commented on July 17, 2024

Hmm... I haven't worked with side modules yet, but I don't believe they have their own address space, that would isolate them completely from the main module and other side modules. As far as I can see from the documentation the difference is that they are 'pure code', without attached runtime (I guess they access the shared runtime from the main module)

I suspect instead that something's wrong about the allocation of the static char _type_id; here when running in the context of a side module:

template<class T> static Oryol::TypeId getTypeId() { static char _type_id; return &_type_id; };\

Maybe the side module's static "allocation counter" is running independent from the main module (and other side modules), so that statics setup in the main and side modules end up in the same memory location.

from oryol.

floooh avatar floooh commented on July 17, 2024

PS: also googling for smth like "emscripten side module static initialization" brings up this fairly recent bug:

emscripten-core/emscripten#6991

Is your emscripten version uptodate?

from oryol.

pixelherodev avatar pixelherodev commented on July 17, 2024

Yeah - locally I build with the incoming branch as per fips's default, and I have a script for Travis that patches fips to use 1.38.12, which is already after the bug was fixed (definitely fixed before 1.38.11 according to that).

from oryol.

pixelherodev avatar pixelherodev commented on July 17, 2024

One (unpleasant) option is an alternative system for Emscripten: global symbols are clearly visible from side modules - I use ImGui built into my main module from my plugins - so we could set a global int - a 32-bit number should be plenty (even if it's an extra 3 bytes per class), and have each class declare a static int that's initialized to the global from the main module ++ on startup. That quadruples the size of the RTTI, but should (if implemented properly) work as a temporary hack until this bug is fixed in Emscripten.

from oryol.

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.