Replace __attribute__((constructor)) with C++ constructor.

The use of __attribute__((constructor)) made the previous commit fail to build in MSVC.

PiperOrigin-RevId: 474891117
Change-Id: I86a71bb8f3226ee49a8b5e8c07adc613623042b3
This commit is contained in:
Saran Tunyasuvunakool
2022-09-16 13:39:07 -07:00
committed by Copybara-Service
parent 1e2a9a53bc
commit 26bdb7c8b8
2 changed files with 16 additions and 12 deletions
+1
View File
@@ -17,6 +17,7 @@ on:
jobs:
mujoco:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
+5 -2
View File
@@ -31,7 +31,6 @@
namespace mujoco {
namespace {
using PluginTest = MujocoTest;
using ::testing::HasSubstr;
using ::testing::NotNull;
@@ -271,7 +270,10 @@ int RegisterActuatorPlugin() {
return mjp_registerPlugin(&plugin);
}
__attribute__((constructor)) void RegisterAllPlugins() {
class PluginTest : public MujocoTest {
public:
// register all plugins
PluginTest() : MujocoTest() {
RegisterSensorPlugin();
for (int i = 1; i <= kNumFakePlugins; ++i) {
@@ -284,6 +286,7 @@ __attribute__((constructor)) void RegisterAllPlugins() {
RegisterActuatorPlugin();
}
};
constexpr char xml[] = R"(
<mujoco>