mirror of
https://frontier.innolan.net/github/amigaos-cross-toolchain6.git
synced 2024-10-19 10:29:55 +00:00
Global C++ constructors and destructors work again. Fixes #42.
This commit is contained in:
@ -7,7 +7,7 @@ BINS = hello-ks13 hello-ks20 hello-ks20.clib2 \
|
||||
hello-stdio hello-stdio.clib2 hello-stdio.nix13 \
|
||||
hello-mui test-mmu \
|
||||
simple.library simple.library_r simple.device \
|
||||
hello-iostream
|
||||
test-ctors hello-iostream
|
||||
|
||||
all: $(BINS) $(OBJS)
|
||||
|
||||
@ -30,7 +30,13 @@ hello-stdio.clib2: hello-stdio.c
|
||||
$(CC) -mcrt=clib2 -m68020 $(CFLAGS) -o $@ $<
|
||||
|
||||
hello-iostream: hello-iostream.cpp
|
||||
$(CXX) -noixemul -m68020 $(CXXFLAGS) -o $@ $<
|
||||
$(CXX) -noixemul -m68020 $(CXXFLAGS) -o $@ $^
|
||||
|
||||
test-ctors: test-ctors.cpp
|
||||
$(CXX) -noixemul -m68020 $(CXXFLAGS) -D__A -c -o test-ctors-a.o $<
|
||||
$(CXX) -noixemul -m68020 $(CXXFLAGS) -D__B -c -o test-ctors-b.o $<
|
||||
$(CXX) -noixemul -m68020 $(CXXFLAGS) -c -o test-ctors.o $<
|
||||
$(CXX) -noixemul -m68020 $(CXXFLAGS) -o $@ test-ctors*.o
|
||||
|
||||
hello-mui: hello-mui.c
|
||||
$(CC) -noixemul -m68020 -msmall-code $(CFLAGS) -o $@ $< -lmui
|
||||
|
||||
29
examples/test-ctors.cpp
Normal file
29
examples/test-ctors.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __A
|
||||
struct A {
|
||||
int i;
|
||||
A(int _i) { i = _i; puts("ctor A"); }
|
||||
~A() { puts("dtor A"); }
|
||||
};
|
||||
|
||||
A a(10);
|
||||
#endif
|
||||
|
||||
#ifdef __B
|
||||
struct B {
|
||||
int i;
|
||||
B(int _i) { i = _i; puts("ctor B"); }
|
||||
~B() { puts("dtor B"); }
|
||||
};
|
||||
|
||||
B b(20);
|
||||
#endif
|
||||
|
||||
#if !defined(__A) && !defined(__B)
|
||||
int main()
|
||||
{
|
||||
puts("hello world!");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
Submodule submodules/gcc-2.95.3 updated: 965e443fcf...f25bf19436
Submodule submodules/libnix updated: b1c9ff1a73...7ab6f71804
Reference in New Issue
Block a user