#include <functional>
+#include <xbt/functional.hpp>
+
#include "src/mc/mc_replay.h"
#include "smx_private.h"
#include "src/mc/mc_forward.hpp"
{
if (name == nullptr)
name = "";
- return (smx_process_t) simcall_BODY_process_create(name, code, data, hostname,
- kill_time, argc, argv, properties,
- auto_restart);
+ auto wrapped_code = simgrid::xbt::wrapMain(code, argc, argv);
+ for (int i = 0; i != argc; ++i)
+ xbt_free(argv[i]);
+ xbt_free(argv);
+ smx_process_t res = simcall_process_create(name,
+ std::move(wrapped_code),
+ data, hostname, kill_time, properties, auto_restart);
+ return res;
}
/**
void simcall_run_kernel(std::function<void()> const& code)
{
- return simcall_BODY_run_kernel((void*) &code);
+ return simcall_BODY_run_kernel(&code);
}
int simcall_mc_random(int min, int max) {