-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cr_main isn't invoked with operation CR_LOAD and the context passed to cr_plugin_load #49
Comments
I looked at your code. Actually, it seems that the first call to the plugin takes place when I invoke if I can give you an advice, I would make this thing explicit in the documentation because, at a first reading, I definitely missed it and thought I could use different values for |
Yes, you're right it is confusing. Basically CR_LOAD has nothing to do with cr_plugin_load (which is basically initializer, which was originally named cr_plugin_init). It is a bit confusing and I'll try to improve the documentation soon, thanks for reporting anyway. This issue may still help others. |
The fact that both rely on the word load is a bit misleading, I agree. May I ask you another thing? |
I see, good catch actually. Thank you for the quick responses. Really appreciated. 👍 |
Oh, I've hit another confusing point due to this line:
Long story short, when I close a plugin I never see My two cents: If I got it, with
Where (unload -> load) means that the plugin has been reloaded. Right? |
Yes, that is also correct! I think my initial rationale was that in the context of hot-reloading, loading/unloading were specific to the hot-reloading part as these are specific steps required for data lifetime cross-instance. The open and closing of plugin does not incur in load and unload, but unfortunately I did not name the function Also in the case of a I think it is a bit late to rename these (if we can even find a better naming), but I'll also put that into the documentation (once I get back from vacancies next year). I may consider further on renaming and deprecation steps. |
Don't worry. You've nothing to apologize for!! Enjoy your vacancies and sorry for the noise. 👍 |
Note that you can use
|
Yeah, sure, I'm using it actually. |
Hello, in the commit above I did some rewording in the doc and added a |
Oh, wow, thank you for taking in consideration my comments. Just one question for curiosity: why did |
Yeah, that one is a bit out of place right now. It was triggering a warning as it is unused and is exposed in the doc as a public API. On the other hand, it is not extern neither a valid C function. So I just removed the static to silence the compiler, no other good reason. Not sure what to do with that one yet :) |
I see, yeah, I've those warning as well actually. Another one comes from a shadowing variable and I thought more than once to open a PR to suppress it too. 😄 |
Which one? :) |
Sure, thanks for inviting. It's a pleasure to work on your code actually, it's well written. 👍
I've never opened an issue because I thought it was on purpose since you put there that comment. |
Oh I see, that was self-inflicted as a protection against typo due the way the docs recommend using the ehdr. I'll try to clean this up better. Fixed. |
Thank you for all your help in here, if there is anything more don't worry reopening this or creating new issues. |
I'm not sure if this is the intended behavior and I haven't found anything in the doc nor the old issues.
I'm using this library on a debian sid, clang 9 for development, the resulting code is meant to be deployed and tested on all the supported platforms.
This is an hypothetical header shared by the main executable and the plugin:
Consider the following snippet for
main.cpp
:This is instead the code for the plugin:
I thought that it was possible to pass a given context during the load and a different one during the update.
However, it seems that the call to
cr_main
is delayed until I invokecr_plugin_update
. At this point,cr_main
is invoked two times with the same context (the one containing a pointer toupdate
) and with different operation (CR_LOAD
, thenCR_STEP
).It's not a big problem. I introduced a wrapper that has two data members for the given types and made it work. However, this is unexpected and somehow counterintuitive.
Is this the case and is there any way I can pass a different pointer through
userdata
to the different phases?The text was updated successfully, but these errors were encountered: