Skip to content

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

@ttzytt

Description

@ttzytt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions