Ivana Ivanovska
ce2ff0a35d
Add support for int return type in Carbon/C++ interop (#5114)
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
```
2025-03-24 15:18:20 +00:00
..
2025-03-19 20:19:21 +00:00
2025-03-19 20:19:21 +00:00
2025-03-14 15:50:03 +00:00
2025-03-19 20:19:21 +00:00
2025-03-14 15:50:03 +00:00
2025-03-10 16:00:35 +00:00
2025-03-21 22:26:08 +00:00
2025-03-14 15:50:03 +00:00
2025-03-17 15:27:41 +00:00
2025-03-10 16:00:35 +00:00
2025-03-04 23:28:42 +00:00
2025-03-21 16:03:25 +00:00
2025-03-21 22:26:08 +00:00
2025-03-21 22:26:08 +00:00
2025-03-10 16:00:35 +00:00
2025-03-10 16:00:35 +00:00
2025-03-19 20:19:21 +00:00
2025-03-21 22:26:08 +00:00
2025-03-14 15:50:03 +00:00
2025-03-21 22:26:08 +00:00
2025-03-24 15:18:20 +00:00
2025-03-10 16:00:35 +00:00
2025-03-19 20:19:21 +00:00
2025-03-19 20:19:21 +00:00
2025-03-19 20:19:21 +00:00
2025-03-10 16:00:35 +00:00
2025-03-19 20:19:21 +00:00
2025-03-17 22:29:56 +00:00
2025-03-14 15:50:03 +00:00
2025-03-19 20:19:21 +00:00
2025-03-19 20:19:21 +00:00
2025-03-19 20:19:21 +00:00
2025-03-19 20:19:21 +00:00
2025-03-19 20:19:21 +00:00
2025-03-14 15:50:03 +00:00