[function] Problem with simple pointer to function
Hello all, I have a problem with boost::function, when I try to assign function to pointer I have a crash. It is simple void function(); boost::function <void (void)> m_Wakeup; and the code where crush occurs looks like: Wakeup = &function; Here is also the dump: Program terminated with signal 6, Aborted. *#0 0x03c4a092 in _dl_start () from /lib/ld-linux.so.2* *#0 0x03c4a092 in _dl_start () from /lib/ld-linux.so.2* *#1 0x03d0eca5 in raise () from /opt/vmware/cimpdk-6.0.0-2768847/debug/build-3825889/lib/libc.so.6* *#2 0x03d104e3 in abort () from /opt/vmware/cimpdk-6.0.0-2768847/debug/build-3825889/lib/libc.so.6* *#3 0x03ca2aec in handleSigSegv () from /opt/vmware/cimpdk-6.0.0-2768847/debug/build-3825889/usr/lib/libsfcBrokerCore.so.0* *#4 0x00310002 in ?? ()* *#5 0x025c060a in move_assign () at /workspace/raid0/src/boost/function/function_template.hpp:998* *#6 swap () at /workspace/raid0/src/boost/function/function_template.hpp:870* *#7 operator=<void (*)()> () at /workspace/raid0/src/boost/function/function_template.hpp:1126* *#8 create_interface () at /workspace/raid0/src/CppWrapper.cpp:298* Do anyone have a clue what was wrong ? Best regards
On 17 Jan 2017, at 10:05, Fu ji <fujimailing@gmail.com> wrote:
I have a problem with boost::function, when I try to assign function to pointer I have a crash. It is simple void function();
I just tried the following code on http://melpon.org/wandbox, it works fine. #include <iostream> #include <boost/function.hpp> void f(void) { std::cout << "Hello World" << std::endl; } int main() { boost::function<void(void)> bf; bf = &f; bf(); } You are also missing critical information, like the boost version that you are using (in my case it was 1.61). I think your question might be better placed on to the boost-users mailing list: http://lists.boost.org/mailman/listinfo.cgi/boost-users Best regards, Hans
Hello Hans, Mine version is also 1.61, additional information - system is ESXi 6.0, compiler i686-linux5.0-gcc. It is really weird because it starts crushing out of the blue. In previous version it works fine, in ESXi 5.5 it also works as expected. What could change ? Since it's header only library it shouldnt be a problem that ESXi is not officially supported. Best regards, Damian 2017-01-17 10:22 GMT+01:00 Hans Dembinski <hans.dembinski@gmail.com>:
On 17 Jan 2017, at 10:05, Fu ji <fujimailing@gmail.com> wrote:
I have a problem with boost::function, when I try to assign function to pointer I have a crash. It is simple void function();
I just tried the following code on http://melpon.org/wandbox, it works fine.
#include <iostream> #include <boost/function.hpp>
void f(void) { std::cout << "Hello World" << std::endl; }
int main() { boost::function<void(void)> bf; bf = &f; bf(); }
You are also missing critical information, like the boost version that you are using (in my case it was 1.61).
I think your question might be better placed on to the boost-users mailing list:
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Best regards, Hans
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/ mailman/listinfo.cgi/boost
participants (2)
-
Fu ji
-
Hans Dembinski