mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Adding support for importing C++ functions with `int` return type in Carbon. Part of #5063 Here is a demo of the functionality: ```c++ // hello_int.h; auto foo_int() -> int; ``` ```c++ // hello_int.cpp #include "hello_int.h" auto foo_int() -> int { return 1; } ``` ```carbon // main.carbon library "Main"; import Cpp library "hello_int.h"; import Core library "io"; fn Carbon_foo(b: i32) { Core.Print(b); } fn Run() -> i32 { Carbon_foo(Cpp.foo_int()); return 0; } ``` ``` $ clang -c hello_int.cpp $ bazel-bin/toolchain/carbon compile main.carbon $ bazel-bin/toolchain/carbon link hello_int.o main.o --output=demo $ ./demo 1 ```