alpaqa pi-pico
Nonconvex constrained optimization
Loading...
Searching...
No Matches
casadi-functions.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "casadi-types.hpp"
5
6#include <alpaqa/util/dl.hpp>
7#include <cassert>
8
9namespace alpaqa {
11namespace casadi {
12
13// clang-format off
14using fname_incref = ExternalFunction<"_incref", void(void)>;
15using fname_decref = ExternalFunction<"_decref", void(void)>;
16using fname_n_in = ExternalFunction<"_n_in", casadi_int(void)>;
17using fname_n_out = ExternalFunction<"_n_out", casadi_int(void)>;
18using fname_name_in = ExternalFunction<"_name_in", const char *(casadi_int ind)>;
19using fname_name_out = ExternalFunction<"_name_out", const char *(casadi_int ind)>;
21using fname_sparsity_out = ExternalFunction<"_sparsity_out", const casadi_int *(casadi_int ind)>;
22using fname_alloc_mem = ExternalFunction<"_alloc_mem", void *(void)>;
23using fname_init_mem = ExternalFunction<"_init_mem", int(void *mem)>;
24using fname_free_mem = ExternalFunction<"_free_mem", int(void *mem)>;
26using fname = ExternalFunction<"", int(const casadi_real **arg, casadi_real **res, casadi_int *iw, casadi_real *w, void *mem)>;
27// clang-format on
28
29template <Name Nm, class Sgn>
30auto ExternalFunction<Nm, Sgn>::load(void *handle, std::string fname)
31 -> signature_t * {
32 static_assert(name.value.back() == '\0');
33 fname += name.value.data();
34 auto func = reinterpret_cast<signature_t *>(util::load_func(handle, fname));
35 assert(func);
36 return func;
37}
38
39} // namespace casadi
41} // namespace alpaqa
#define BEGIN_ALPAQA_CASADI_LOADER_NAMESPACE
#define END_ALPAQA_CASADI_LOADER_NAMESPACE
void * load_func(void *lib_handle, const std::string &name)
Get a pointer to a function inside of a loaded DLL or SO file.
Definition dl.cpp:66
double casadi_real
constexpr const auto inf
Definition config.hpp:112
long long int casadi_int
Reference to CasADi function.
static signature_t * load(void *handle, std::string fname)