42 #include <px4_platform_common/module.h> 43 #include <px4_platform_common/log.h> 53 PRINT_MODULE_DESCRIPTION(
56 Load and run a dynamic PX4 module, which was not compiled into the PX4 binary. 59 $ dyn ./hello.px4mod start 62 PRINT_MODULE_USAGE_NAME_SIMPLE("dyn",
"command");
63 PRINT_MODULE_USAGE_ARG(
"<file>",
"File containing the module",
false);
64 PRINT_MODULE_USAGE_ARG(
"arguments...",
"Arguments to the module",
true);
73 void *handle = dlopen(argv[1], RTLD_NOW);
76 PX4_ERR(
"%s", dlerror());
80 void *main_address = dlsym(handle,
"px4_module_main");
83 PX4_ERR(
"%s", dlerror());
88 auto main_function = (int (*)(int,
char **))main_address;
90 return main_function(argc - 1, argv + 1);
__EXPORT int dyn_main(int argc, char *argv[])