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
Add C-C++ Interoperability tutorial in CppInterOp docs #121
Add C-C++ Interoperability tutorial in CppInterOp docs #121
Conversation
Codecov Report
@@ Coverage Diff @@
## main #121 +/- ##
==========================================
+ Coverage 62.91% 63.19% +0.28%
==========================================
Files 15 16 +1
Lines 4061 4103 +42
==========================================
+ Hits 2555 2593 +38
- Misses 1506 1510 +4 |
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.
Paying attention to the details is critical especially in writing documentation.
docs/tutorials.rst
Outdated
it will be used to store the instantiated template. The **InstantiationArgs** | ||
is initialized to "A", it will be used as the argument when instantiating the template. | ||
T is initialized to zero, used to store the declaration of the type "T" used for |
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.
T is initialized to zero, used to store the declaration of the type "T" used for | |
`T` is initialized to zero, used to store the declaration of the type "T" used for |
docs/tutorials.rst
Outdated
We take the first argument (argv[1]), parse it, then take the second argument | ||
(argv[2]) using Clang_LookupName, and reassigns InstantiationArgs to the third | ||
argument (argv[3]). In the else case, we decide to go with the "A". |
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 snippet checks command-line arguments were provided by the argc arguments. | |
We take the first argument (argv[1]), parse it, then take the second argument | |
(argv[2]) using Clang_LookupName, and reassigns InstantiationArgs to the third | |
argument (argv[3]). In the else case, we decide to go with the "A". | |
This snippet checks command-line arguments were provided by the `argc` arguments. | |
We take the first argument (`argv[1]`), parse it, then take the second argument | |
(`argv[2]`) using **Clang_LookupName**, and reassigns **InstantiationArgs** to the third | |
argument (`argv[3]`). In the else case, we decide to go with the "A". |
docs/tutorials.rst
Outdated
type, using the Clang_InstantiateTemplate function from the | ||
library. The instantiated template is stored in the **Instantiation**. |
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.
The code proceeds to instantiate the template B::callme with the given | |
type, using the Clang_InstantiateTemplate function from the | |
library. The instantiated template is stored in the **Instantiation**. | |
The code proceeds to instantiate the template `B::callme` with the given | |
type, using the **Clang_InstantiateTemplate** function from the | |
library. The instantiated template is stored in the **Instantiation**. |
docs/tutorials.rst
Outdated
the function taking a void* argument and returning void. The result of | ||
Clang_GetFunctionAddress is casted by the function pointer. |
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.
A function pointer **callme_fn_ptr** is declared with a type fn_def that represents | |
the function taking a void* argument and returning void. The result of | |
Clang_GetFunctionAddress is casted by the function pointer. | |
A function pointer **callme_fn_ptr** is declared with a type `fn_def` that represents | |
the function taking a `void*` argument and returning void. The result of | |
**Clang_GetFunctionAddress** is casted by the function pointer. |
docs/tutorials.rst
Outdated
pointer to this object is stored in NewA. |
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.
The code then creates an object of type `A` using Clang_CreateObject, and the | |
pointer to this object is stored in NewA. | |
The code then creates an object of type `A` using **Clang_CreateObject**, and the | |
pointer to this object is stored in `NewA`. |
docs/tutorials.rst
Outdated
calls the member function B::callme with the instantiated type. Thus, the instantiation | ||
happens with type `A` and we get the below result. |
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.
Then the function pointer callme_fn_ptr is called with the NewA, which | |
calls the member function B::callme with the instantiated type. Thus, the instantiation | |
happens with type `A` and we get the below result. | |
Then the function pointer `callme_fn_ptr` is called with the `NewA`, which | |
calls the member function `B::callme` with the instantiated type. Thus, the instantiation | |
happens with type `A` and we get the below result. |
5ae6a73
to
4835e89
Compare
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!
No description provided.