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

Allow empty struct or provide a way to typealias externals #1514

Open
derolf opened this issue Mar 27, 2023 · 1 comment
Open

Allow empty struct or provide a way to typealias externals #1514

derolf opened this issue Mar 27, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@derolf
Copy link

derolf commented Mar 27, 2023

doesn't work:

@Cpp(EnableIf)
struct FollyIOBuf {
    external {
        cpp include "foo.h"
        cpp name "std::unique_ptr<Foo>"
    }
}

workaround:

@Cpp(EnableIf)
struct FollyIOBuf {
    external {
        cpp include "foo.h"
        cpp name "std::unique_ptr<Foo>"
    }

  dummy: String;
}

I think a better solution would be to allow "external typealiases".

@derolf derolf changed the title Allow empty struct Allow empty struct or provide a way to typealias externals Mar 27, 2023
@Hsilgos
Copy link
Contributor

Hsilgos commented Mar 28, 2023

There is a reason why empty struct is not allowed for external types. External type is meant to be serialisable to transfer between languages. struct FollyIOBuf in your example is internal type which keeps some data to serialise/deserialise and then convert to std::unique_ptr<Foo>

@Hsilgos Hsilgos added the enhancement New feature or request label Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants