From 86ea2f146640b49bafdfbcfd5b04b195f14434e7 Mon Sep 17 00:00:00 2001 From: James Benton Date: Wed, 30 May 2018 21:56:29 +0100 Subject: [PATCH] Add a simple .rpl file example. --- samples/my_first_rpl/CMakeLists.txt | 15 +++++++++++++++ samples/my_first_rpl/exports.def | 2 ++ samples/my_first_rpl/my_first_rpl.c | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 samples/my_first_rpl/CMakeLists.txt create mode 100644 samples/my_first_rpl/exports.def create mode 100644 samples/my_first_rpl/my_first_rpl.c diff --git a/samples/my_first_rpl/CMakeLists.txt b/samples/my_first_rpl/CMakeLists.txt new file mode 100644 index 0000000..dd8e047 --- /dev/null +++ b/samples/my_first_rpl/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.2) +project(my_first_rpl C) +include("${WUT_ROOT}/share/wut.cmake" REQUIRED) + +add_executable(my_first_rpl + my_first_rpl.c) + +wut_add_exports(my_first_rpl + exports.def) + +wut_create_rpl(my_first_rpl.rpl + my_first_rpl) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/my_first_rpl.rpl" + DESTINATION "${CMAKE_INSTALL_PREFIX}") diff --git a/samples/my_first_rpl/exports.def b/samples/my_first_rpl/exports.def new file mode 100644 index 0000000..a2d31f6 --- /dev/null +++ b/samples/my_first_rpl/exports.def @@ -0,0 +1,2 @@ +:TEXT +my_first_export diff --git a/samples/my_first_rpl/my_first_rpl.c b/samples/my_first_rpl/my_first_rpl.c new file mode 100644 index 0000000..e057542 --- /dev/null +++ b/samples/my_first_rpl/my_first_rpl.c @@ -0,0 +1,20 @@ +#include + +int +my_first_export() +{ + return 1; +} + +int +rpl_main(OSDynLoad_Module module, + OSDynLoad_EntryReason reason) +{ + if (reason == OS_DYNLOAD_LOADED) { + // Do stuff on load + } else if (reason == OS_DYNLOAD_UNLOADED) { + // Do stuff on unload + } + + return 0; +}