mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Simplify app to more match Roc's controlled environment
This commit is contained in:
parent
16c929d33a
commit
b84d958a9a
3 changed files with 16 additions and 17 deletions
|
@ -1,6 +1,6 @@
|
||||||
SHARED_ARGS = -fPIC -ffunction-sections
|
SHARED_ARGS = -fPIC -ffunction-sections
|
||||||
|
|
||||||
all: platform
|
all: platform app.o
|
||||||
|
|
||||||
platform: platform.o linker.ld libapp.so
|
platform: platform.o linker.ld libapp.so
|
||||||
$(CXX) $(SHARED_ARGS) -L. -lapp -fPIE -T linker.ld -o $@ $<
|
$(CXX) $(SHARED_ARGS) -L. -lapp -fPIE -T linker.ld -o $@ $<
|
||||||
|
@ -8,6 +8,9 @@ platform: platform.o linker.ld libapp.so
|
||||||
platform.o: platform.cc
|
platform.o: platform.cc
|
||||||
$(CXX) $(SHARED_ARGS) -c -o $@ $^
|
$(CXX) $(SHARED_ARGS) -c -o $@ $^
|
||||||
|
|
||||||
|
app.o: app.cc
|
||||||
|
$(CXX) -fPIC -c -o $@ $^
|
||||||
|
|
||||||
libapp.so: app.cc
|
libapp.so: app.cc
|
||||||
$(CXX) $(SHARED_ARGS) -shared -o $@ $^
|
$(CXX) $(SHARED_ARGS) -shared -o $@ $^
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
#include <iostream>
|
const char* init() { return "Application initializing...\n"; }
|
||||||
|
const char* app() { return "Hello World from the application\n"; }
|
||||||
void init() { std::cout << "Application initializing...\n"; }
|
const char* cleanup() { return "Cleaning up application...\n"; }
|
||||||
void app() { std::cout << "Hello World from the application\n"; }
|
|
||||||
int cleanup() {
|
|
||||||
std::cout << "Cleaning up application...\n";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void init();
|
const char* init();
|
||||||
void app();
|
const char* app();
|
||||||
int cleanup();
|
const char* cleanup();
|
||||||
|
|
||||||
void func_section_1() { init(); }
|
void func_section_1() { std::cout << init(); }
|
||||||
|
|
||||||
void func_section_2() { app(); }
|
void func_section_2() { std::cout << app(); }
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::cout << "Hello World from the platform\n";
|
std::cout << "Hello World from the platform\n";
|
||||||
|
@ -15,7 +15,8 @@ int main() {
|
||||||
|
|
||||||
// Long term we want to support this case cause if it accidentially arises, we
|
// Long term we want to support this case cause if it accidentially arises, we
|
||||||
// don't want bugs.
|
// don't want bugs.
|
||||||
int (*func_pointer)();
|
const char* (*func_pointer)();
|
||||||
func_pointer = &cleanup;
|
func_pointer = &cleanup;
|
||||||
return (*func_pointer)();
|
std::cout << (*func_pointer)();
|
||||||
|
return 0;
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue