-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
How to Get Dynamic Loading of Views on macOS? #360
Comments
@rbugajewski If you run your application in macOS, dynamic views should not be compiled into the application statically. This means that if the view is statically compiled, it cannot be updated via dynamic view loading. You can create a directory outside the compilation folder and move views into it during development. |
Thanks for the clarification, I would suggest to add this one sentence to the documentation. I particularly don’t like to move stuff around, even during development, so I currently just set an invalid The dynamic loading works now, but I sometimes get a crash.
I don’t see this as critical, because I think this is only related to dynamic loading that should only be used during development, but I wanted to let you know nonetheless. |
Issue resolve by using drogon dynamically. |
@ihmc3jn09hk , You should configure your project with |
@an-tao Still no luck with the update. Do I need to new a drogon_ctl project? At my side, any view was compiled since the ${VIEWSRC} has been removed mannually for this purpose. The build directory contains no "any-views.h" or "any-views.cc". The views were built and load in runtime. However, the response was not updated even with the .so .cc .h had been updated (Checked manually). Well, for your information, I was testing with a small editing, e.g. the color of a style element in the .csp
I dont think it is the case because the built .cc and .so files do contain such modification. Just for your reference. |
Do you get "symbol not found" output when loading a view? |
That symbol resolve error was fixed by recompile drogon with BUILD_SHARED_LIB=1 Ubuntu 18.04 with glibc. I am wondering if the problem related to musl vs glibc. I am not using musl |
So it works now?
I've not tested this with musl, if it can't work with musl, I think it's reasonable because musl is somehow different with glibc. |
The dynamic view is still not working on my system. Will do more testing on that part in some day. It's not fatal tho UI design in C++ is not a preferable practise. |
I solved the issue by commenting out the dynamic generation of view files in CMakeLists.txt:
And uncommenting the "ENABLE_EXPORTS" line:
|
There is an issue with dynamic view loading during development and usage of the This is related to #338. |
|
Here’s what I’ve found out for macOS. There are two cases (dynamic loading turned on is a prerequisite). The application has a First Case: Page ModificationDoesn’t Work
In this case nothing happens as I think the first view issue applies here. Works
The change gets picked up, but it is required to trigger a recompile of the first dummy Second Case: Layout ModificationDoesn’t Work
In this case a dynamic recompile gets triggered, but the change doesn’t get picked up. Doesn’t Work
What happens in this case is that the modifications for |
@rbugajewski Please paste the MyPage.cc generated by drogon_ctl. |
By actually creating an almost empty dummy |
Dynamic compilation of views works on macOS after I set the configuration variable
load_dynamic_views
as stated in the documentation. I can see the corresponding log output and there’s also a handle from thedlopen()
call inloadLibs()
.Although this mechanism works, I doesn’t look like the framework would pick up these new libraries during its runtime on macOS as I need to restart the process to see newly added CSP output.
Steps to Reproduce
load_dynamic_views
totrue
../views
to thedynamic_views_path
configuration arraydynamic_views_output_path
to./
views/Index.csp
and some example content like “Hello, world!”Index.csp
file, for example by changing the string to “Hello, universe!”Expected behavior
The page should output “Hello, universe!”.
Actual results
The page still displays “Hello, world!”.
Desktop:
The text was updated successfully, but these errors were encountered: