SET(DOTNET_LAUNCHER "dotnet-launcher")
SET(${DOTNET_LAUNCHER}_SOURCE_FILES
launcher/main.cc
+ launcher/injection.cc
launcher/launcher.cc
launcher/dotnet/dotnet_launcher.cc
)
INSTALL(FILES inc/dotnet_launcher_plugin.h DESTINATION ${INCLUDEDIR})
INSTALL(FILES installer-plugin/ni_common.h DESTINATION ${INCLUDEDIR})
INSTALL(FILES ../dotnet-launcher.pc DESTINATION ${LIBDIR}/pkgconfig)
-
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "log.h"
+
+#include <cstdlib>
+#include <cstring>
+
+static int injectLibrary(const char path[])
+{
+ return 0;
+}
+
+int doInjection()
+{
+ int res = -1;
+ char *env = nullptr;
+ char* injectableLibs = nullptr;
+ const char *delim = ", ";
+ char *lib = nullptr;
+
+ env = getenv("DOTNET_LAUNCHER_INJECT");
+ if (env == nullptr) {
+ res = 0;
+ goto ret;
+ }
+
+ _INFO("##### Perform injection #########");
+
+ injectableLibs = strdup(env);
+ if (injectableLibs == nullptr) {
+ _ERR("Fail to allocate memory for injectable library paths\n");
+ goto ret;
+ }
+
+ res = 0;
+ lib = strtok(injectableLibs, delim);
+ for(; lib != nullptr; lib = strtok(nullptr, delim)) {
+ if (injectLibrary(lib) != 0) {
+ res = -1;
+ break;
+ }
+ }
+
+ if (res == 0) {
+ _INFO("##### Injection finished #########");
+ } else {
+ _INFO("##### Injection failed #########");
+ }
+
+ret:
+ free(injectableLibs);
+
+ return res;
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __INJETION_INTERFACE_H__
+#define __INJETION_INTERFACE_H__
+
+int doInjection();
+
+#endif // __INJETION_INTERFACE_H__
* limitations under the License.
*/
+#include "injection.h"
#include "dotnet/dotnet_launcher.h"
#include "utils.h"
#include "log.h"
int main(int argc, char *argv[])
{
+ int res = doInjection();
+ if (res != 0) {
+ return 1;
+ }
+
return realMain(argc, argv, "default");
}
-
* --standalone [assembly path]
Run assembly with the current user environment.
+#### environment
+
+* DOTNET_LAUNCHER_INJECT
+ A list of additional libraries to be loaded with `dlopen()` and call to
+ `int dotnet_launcher_inject()` initialization hook. If hook returns non-zero
+ status initialization will be failed. The items of the list can be separated
+ by spaces or colons, and there is no support for escaping either separator.
+
----
### Anatomy