[all-commits] [llvm/llvm-project] f9cac5: [flang-rt] Add the ability to have user supplied c...
David Parks via All-commits
all-commits at lists.llvm.org
Fri Aug 29 09:07:08 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f9cac5f1d50f916de4515ed5f5b3709a706fca44
https://github.com/llvm/llvm-project/commit/f9cac5f1d50f916de4515ed5f5b3709a706fca44
Author: David Parks <code.optimizer at gmail.com>
Date: 2025-08-29 (Fri, 29 Aug 2025)
Changed paths:
M flang-rt/include/flang-rt/runtime/environment.h
M flang-rt/lib/runtime/environment.cpp
Log Message:
-----------
[flang-rt] Add the ability to have user supplied callback functions to further customize the runtime environment. (#155646)
Add the ability to have pre and post call back functions to
ExecutionEnvironment::Configure() to allow further customization of the
flang runtime environment (called from _FortranAStartProgam) in
situations where either the desired features/functionality are
proprietary or are too specific to be accepted by the flang community.
Example:
Custom constructor object linked with flang objects:
```
#include "flang-rt/runtime/environment.h"
#include "flang/Runtime/entry-names.h"
#include "flang/Runtime/extensions.h"
namespace Fortran::runtime {
// Do something specific to the flang runtime environment prior to the
// core logic of ExecutionEnvironment::Configure().
static void
CustomPreConfigureEnv(int argc, const char *argv[], const char *envp[],
const EnvironmentDefaultList *envDefaultList) {
puts(__func__);
}
// Do something specific to the flang runtime environment after running the
// core logic of ExecutionEnvironment::Configure().
static void
CustomPostConfigureEnv(int argc, const char *argv[], const char *envp[],
const EnvironmentDefaultList *envDefaultList) {
puts(__func__);
}
void __attribute__((constructor)) CustomInitCstor(void) {
// Possibilities:
// RTNAME(RegisterConfigureEnv)(&CustomPreConfigureEnv,
// &CustomPostConfigureEnv); RTNAME(RegisterConfigureEnv)(nullptr,
// &CustomPostConfigureEnv);
RTNAME(RegisterConfigureEnv)(&CustomPreConfigureEnv, nullptr);
}
} // namespace Fortran::runtime
```
---------
Co-authored-by: David Parks <dparks at nvidia.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list