#include "Pooling.hpp"
#include "Trampoline.t.hpp"
+extern "C" void CYHandleServer(pid_t);
+
void InjectLibrary(pid_t pid) {
- const char *library(CY_LIBRARY);
+ Dl_info addr;
+ _assert(dladdr(reinterpret_cast<void *>(&CYHandleServer), &addr) != 0);
+ const char *library(addr.dli_fname);
mach_port_t self(mach_task_self()), task;
_krncall(task_for_pid(self, pid, &task));
libcycript_la_SOURCES += Handler.mm
cycript_SOURCES += Mach/Inject.cpp
-AM_CPPFLAGS += -DCY_ATTACH -DCY_LIBRARY='"$(libdir)/libcycript.$(SO)"'
+AM_CPPFLAGS += -DCY_ATTACH
Mach/Inject.$(OBJEXT): Trampoline.t.hpp
@CY_OBJECTIVEC_TRUE@am__append_6 = ObjectiveC/Output.mm ObjectiveC/Replace.cpp ObjectiveC/Library.mm
@CY_MACH_TRUE@am__append_7 = Handler.mm
@CY_MACH_TRUE@am__append_8 = Mach/Inject.cpp
-@CY_MACH_TRUE@am__append_9 = -DCY_ATTACH -DCY_LIBRARY='"$(libdir)/libcycript.$(SO)"'
+@CY_MACH_TRUE@am__append_9 = -DCY_ATTACH
@CY_MACH_TRUE@am__append_10 = Trampoline.t.lo libTrampoline.t.la \
@CY_MACH_TRUE@ Trampoline.t.hpp
subdir = .