1 // Copyright 2023 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #[allow(unsafe_op_in_unsafe_fn)] 6 #[cxx::bridge] 7 mod ffi { 8 extern "Rust" { rust_calling_cpp()9 fn rust_calling_cpp(); 10 } 11 12 unsafe extern "C++" { 13 include!("build/rust/tests/test_rust_calling_cpp/cpp_library.h"); 14 mul_by_2_in_cpp_library(a: i32) -> i3215 fn mul_by_2_in_cpp_library(a: i32) -> i32; 16 } 17 } 18 19 #[no_mangle] rust_calling_cpp()20pub fn rust_calling_cpp() { 21 assert_eq!(ffi::mul_by_2_in_cpp_library(3), 6); 22 } 23