danomatika / ofxPd

(maintained) a Pure Data addon for OpenFrameworks using libpd
Other
202 stars 45 forks source link

pd.closePatch() not working with Emscripten #88

Closed Jonathhhan closed 10 months ago

Jonathhhan commented 2 years ago

Since compiling works (with the version from ofxOfelia - which is really great), my only issue is that pd.closePatch does not work. Will look for a solution myself, but maybe it is also good to mention it here.

danomatika commented 2 years ago

How does it not work? Minimal code example?

Jonathhhan commented 2 years ago

It happens here: pd.closePatch(patch); in the pdExample patch. https://github.com/danomatika/ofxPd/blob/master/pdExample/src/ofApp.cpp This is the error message:

pdExample.js:1 Uncaught RuntimeError: null function or function signature mismatch
    at pd_free (pdExample.wasm:0x18c3e)
    at libpd_closefile (pdExample.wasm:0x42875)
    at ofxPd::closePatch(pd::Patch&) (pdExample.wasm:0x72698)
    at ofApp::setup() (pdExample.wasm:0x107551)
    at ofNode::onParentOrientationChanged(glm::qua<float, (glm::qualifier)0>&) (pdExample.wasm:0x77416)
    at std::__2::__function::__func<std::__2::shared_ptr<of::priv::Function<ofKeyEventArgs, std::__2::recursive_mutex> > ofEvent<ofKeyEventArgs, std::__2::recursive_mutex>::make_function<ofMainLoop>(ofMainLoop*, void (ofMainLoop::*)(ofKeyEventArgs&), int)::'lambda'(void const*, ofKeyEventArgs&), std::__2::allocator<std::__2::shared_ptr<of::priv::Function<ofKeyEventArgs, std::__2::recursive_mutex> > ofEvent<ofKeyEventArgs, std::__2::recursive_mutex>::make_function<ofMainLoop>(ofMainLoop*, void (ofMainLoop::*)(ofKeyEventArgs&), int)::'lambda'(void const*, ofKeyEventArgs&)>, bool (void const*, ofKeyEventArgs&)>::operator()(void const*&&, ofKeyEventArgs&) (pdExample.wasm:0x287a3)
    at ofEvent<ofHttpResponse, std::__2::recursive_mutex>::notify(ofHttpResponse&) (pdExample.wasm:0x1c50a)
    at ofCoreEvents::notifySetup() (pdExample.wasm:0x79941)
    at ofxAppEmscriptenWindow::loop() (pdExample.wasm:0xe229b)
    at std::__2::__function::__func<void (*)(), std::__2::allocator<void (*)()>, void ()>::operator()() (pdExample.wasm:0xc20b2)
danomatika commented 2 years ago

Add an ofLog before it's called and print the patch handle, ie. void *. If it's null, maybe Emscripten is optimizing it out for some reason since it doesn't refer to a "real type?"

Jonathhhan commented 1 year ago

@danomatika the issue is solved here: https://github.com/pure-data/pure-data/pull/688

danomatika commented 1 year ago

Maybe we can pull out the changes needed to fix this as a separate PR. Since it’s a smaller change, it has a better chance to get Miller’s attention.

enohp ym morf tnes

Dan Wilcox danomatika.com robotcowboy.com

On Sep 17, 2022, at 4:50 AM, Jonathan @.***> wrote:

 The issue is solved here: pure-data/pure-data#688

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

Jonathhhan commented 1 year ago

Not sure, because it will not work without the other changes, but here is a branch with only that change: https://github.com/Jonathhhan/pure-data/blob/emscripten_close_patch/src/m_pd.c

danomatika commented 10 months ago

Closing this for now as it is an upstream issue. I will not include custom changes to libpd in this repo.