parent
127977153a
commit
14507f50df
4 changed files with 0 additions and 57 deletions
|
|
@ -1,12 +0,0 @@
|
|||
-include ../tools.mk
|
||||
|
||||
all: foo
|
||||
$(call RUN,foo)
|
||||
|
||||
foo: foo.rs $(call NATIVE_STATICLIB,foo)
|
||||
$(RUSTC) $< -lfoo $(EXTRACXXFLAGS)
|
||||
|
||||
$(TMPDIR)/libfoo.o: foo.cpp
|
||||
$(call COMPILE_OBJ_CXX,$@,$<)
|
||||
|
||||
.PHONY: all
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct A {
|
||||
A() { v = 1234; }
|
||||
~A() { v = 1; }
|
||||
uint32_t v;
|
||||
};
|
||||
|
||||
A a;
|
||||
|
||||
extern "C" {
|
||||
uint32_t get() {
|
||||
return a.v;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Tests that linking to C++ code with global destructors works.
|
||||
|
||||
extern { fn get() -> u32; }
|
||||
|
||||
fn main() {
|
||||
let i = unsafe { get() };
|
||||
assert_eq!(i, 1234);
|
||||
}
|
||||
|
|
@ -59,14 +59,12 @@ endif
|
|||
|
||||
ifdef IS_MSVC
|
||||
COMPILE_OBJ = $(CC) -c -Fo:`cygpath -w $(1)` $(2)
|
||||
COMPILE_OBJ_CXX = $(CXX) -c -Fo:`cygpath -w $(1)` $(2)
|
||||
NATIVE_STATICLIB_FILE = $(1).lib
|
||||
NATIVE_STATICLIB = $(TMPDIR)/$(call NATIVE_STATICLIB_FILE,$(1))
|
||||
OUT_EXE=-Fe:`cygpath -w $(TMPDIR)/$(call BIN,$(1))` \
|
||||
-Fo:`cygpath -w $(TMPDIR)/$(1).obj`
|
||||
else
|
||||
COMPILE_OBJ = $(CC) -c -o $(1) $(2)
|
||||
COMPILE_OBJ_CXX = $(CXX) -c -o $(1) $(2)
|
||||
NATIVE_STATICLIB_FILE = lib$(1).a
|
||||
NATIVE_STATICLIB = $(call STATICLIB,$(1))
|
||||
OUT_EXE=-o $(TMPDIR)/$(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue