Erick Tryzelaar wrote: > Jonathan Kelly wrote: >> Hi, >> >> I'm trying to wrap "signal" like this ... >> >> //------------------ >> const SIGINT:int = "SIGINT"; >> proc signal:int*(int->void) = "signal($1, $2)"; >> proc finish(sig:int) { >> C_hack::ignore(endwin()); >> print$ f"finish got signal %d\n" sig; >> C_hack::ignore(gc()); >> System::exit(0); >> } signal(SIGINT, finish); > > The problem you're running into will be solved if you use "the": > > signal(SIGINT, the finish); > > > > Of course, this leads to a new bug :) This errors out with this: > > foo2.cpp: In function 'void > flxusr::foo2::_init_(flxusr::foo2::thread_frame_t*)': > foo2.cpp:67: error: cannot convert 'flxusr::foo2::_pt6472*' to 'void > (*)(int)' for argument '2' to 'void (* signal(int, void (*)(int)))(int)' > compilation terminated due to -Wfatal-errors. > > > Looking at the generated code, it's easy to see what the problem is. > Here's the function: > > void FLX_REGPARM _init_(FLX_APAR_DECL_ONLY){ > { > _pt6472* _tmp6500 = (FLX_NEWP(finish)(FLX_FPAR_PASS_ONLY)); > signal(SIGINT, _tmp6500) > } > } > > and the type for _pt6472: > > //TYPE 6472: int<1848> -> void > struct _pt6472: con_t { > typedef void rettype; > typedef int argtype; > virtual con_t *call(con_t *, int const &)=0; > virtual _pt6472 *clone()=0; > virtual con_t *resume()=0; > }; > > This obviously cannot be cast to "void (*)(int)" as it's a struct. I > think there's some fancy thing you can do with "callback" and "-->", > but I haven't figured it out yet. > > -e > >
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language