Please add a prefix: extern "C" before the sleep wrapper and other libc wrappers, in general. You didn't have to do this for the dmtcp_event_hook function because it's declared as a C function in the DMTCP header file (see: dmtcp.h).
The reason you need to do this is: name mangling. The C++ compiler mangles function names by default. As a result, a call to a function "sleep" will bypass any definitions that don't exactly match the symbol name. (Use "nm -D" to examine the symbols defined in a shared library.) To disable name mangling for a function you need to declare it as a C function. On Mon, Oct 31, 2016 at 05:17:28PM +0530, Nisarg Shah wrote: > Hi, I wanted to ask whether plugins written in C++ are supported or > not (and whether they need any special instructions for compilation). > This is because when I renamed the sleep1.c plugin file from > test/plugin/sleep1 to sleep1.cpp and compiled the shared library from > within DMTCP_ROOT directory using > > g++ -shared -fPIC -I./include -o test/plugin/sleep1/sleep1.so > test/plugin/sleep1/sleep1.cpp > > and included it while running test/dmtcp1 example > > bin/dmtcp_launch --with-plugin test/plugin/sleep1/sleep1.so test/dmtcp1 > > I observed that dmtcp_event_hook is being called when a plugin event > occurs but the wrapper function for sleep is not being called. > > ------------------------------------------------------------------------------ > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik > _______________________________________________ > Dmtcp-forum mailing list > Dmtcp-forum@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dmtcp-forum ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Dmtcp-forum mailing list Dmtcp-forum@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dmtcp-forum