Skip to content
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

Using elements defined in cpp! macro in other cpp files #113

Open
ttzytt opened this issue Jul 16, 2024 · 0 comments
Open

Using elements defined in cpp! macro in other cpp files #113

ttzytt opened this issue Jul 16, 2024 · 0 comments

Comments

@ttzytt
Copy link

ttzytt commented Jul 16, 2024

From the example provided, I know that you can include other libraries in the C++ blocks:

cpp!{{
    #include <iostream>
}}

I'm wondering if it is possible to use things defined in cpp! macros in other C++ files. For example, one can define a function in the block like this:

cpp!{{
    #include <iostream>
    int cpp_func(){
        return 42;
    }
}}

Are there any ways for other cpp files to use the function cpp_func?

If this is possible, then I believe this project can also be used to embed Rust code in C++, as one can wrap all the C++ code by cpp! and insert Rust by rust!.

Also, is it possible to open a discussion page for this project? I believe it is more suitable to place questions like this on the discussion page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant