-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Improve documentation related to JL_GC_PUSH* #30399
Conversation
Hi @yuyichao Thanks for the review! I have modified the commit according to your suggestions. Please, see if everything is OK now. |
Done @yuyichao ! I think added all your advices to the PR now. Please, see if everything seems right. Thanks for the review again! |
@yuyichao done! |
Btw @yuyichao , is there an easy way to create the
I am thinking to put the example when you have to wrap around a |
Errr.......... So a few problems,
|
@yuyichao yes, I understood. This was just a little example to see the easiest way to create a jl_value_t* var = jl_eval_string("sqrt(2.0)");
JL_GC_PUSH1(&var);
jl_datatype_t* reft = (jl_datatype_t*)jl_eval_string("Base.RefValue{Any}");
jl_value_t* rvar = jl_new_struct(reft, &var);
JL_GC_POP();
jl_function_t* setindex = jl_get_function(jl_base_module, "setindex!");
jl_value_t* refs = jl_eval_string("refs = IdDict()");
jl_call3(setindex, refs, rvar, rvar); Is it correct? |
Well, that's fine, as long as you don't
Putting this example here will definitely not make it more clear to the user.
And given that you've asked about |
Fair enough! Sorry about the confusion, I will not put that first code in PR. I will add this and submit for your review. Thank you very much for your time 👍 |
Done @yuyichao , hope I got everything right this time! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would be good to also explain why rather than how. though that's not something I am very good at doing either.
Hi @yuyichao, I can try to dig the information and submit another PR more explanation about what is going on under the hood! Can you please point me to where should I look for the information to understand what’s going on ? I confess that I am very new in this area (embedding Julia in C), but I have a lot of interest given future projects I envision in my institute. |
Here's a great article on documentation which shows quite clearly (IMO) that these are two complimentary things, and each quite important in their own ways: https://www.divio.com/blog/documentation/ Highly recommended as a great tool for clarifying what needs to be written in a given piece of documentation. |
Hi guys, Should I do anything more here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I made a couple of grammatical fixes and some minor edits to make sure it fits into the surrounding documentation.
Travis failures are unrelated so I'm merging this. (Linux failures are #27788; OSX failure is a single failure in SharedArrays.) |
* Add detail to JL_GC_PUSH / JL_GC_POP documentation * Add section on rooting of objects outside the stack * Make section heading regarding updating fields of GC-managed objects, as this no longer flows on from the previous section. Co-authored-by: Chris Foster <[email protected]>
I've squashed the changes and pushed that to master manually. I did this on the command line to preserve the authorship info; it's frustrating but it seems github will overwrite the author if you click the "Squash+merge" button. This has also confused the github UI a bit, but don't worry, it's in master. Perhaps the right thing is to squash on the command line, force push to the PR branch, and then click the rebase+merge button. I don't know why preserving authorship via the UI is so hard for github to get right :-( Anyone who knows better how to deal with squashing multi-author changes, please let me know! |
Hi guys,
I had some problems related to embedding Julia in C/C++ software. I posted some topics in Discourse and, finally, I managed to make it work. This PR tries to improve the documentation based on my experience and some advices I found on old Discourse posts. Please, help me to review this, because I am not entirely sure that everything is correct.