robotconscience / ofxLibwebsockets

[Deprecated] openFrameworks wrapper of libwebsockets for WebSocket client and server functionality
Other
171 stars 68 forks source link

defined but not used warnings #58

Closed fx-lange closed 9 years ago

fx-lange commented 9 years ago

Hi there and great work btw,

I get a lot of these defined but not used [-Wunused-function] warnings and because most of them are located in header files I get them spammed every single compile (independent of what I worked on).

After some digging I think the problem is caused by using static / internal linkage and implementing them in the header files. This way even if the function is used we get the warning (because every translation unit has its own version ...). I still don't get it 100% but tried to tag them as extern and moved the implementations to the source file. Compiles fine but for example the server_echo example crashes on opening the browser client.

Not sure if I'm totally wrong or just missing a tiny thing. Perhaps you could have a quick look at my changes: https://github.com/ixds/ofxLibwebsockets/tree/warnings

The example crashes in

ofxLibwebsockets::lws_callback() at Util.cpp:175 0x425a86 -> ofxLibwebsockets::Reactor::_http() at Reactor.cpp:283

and document_root seems to be broken.

Any ideas?

Best, Felix

robotconscience commented 9 years ago

Hello! Thanks for looking into this. I think this makes sense to me, embarrassed I didn't do this myself, ha.

What platform are you on, and what example are you using? It could be an error with defaultServerOptions() [which sets the document_root var on setup]; in your setup this function needs to be moved to Server.cpp. It also could be that "document_root" needs to a default value in Reactor.cpp [which is ofToDataPath("web", true) in our lib]. That'd be my mistake!

Let me know if that helps. Thanks for looking into this!

Let me know if any of that helps!

fx-lange commented 9 years ago

Hi thanks for the fast reply,

working on Ubuntu and testing the example_server_echo. Your hints are exactly what I was hoping for. Will check them today.

fx-lange commented 9 years ago

Sorry my debugging was a little bit sloppy, document_root was fine but the reactor pointer in lws_callback() was NULL ..., because the reactor vector was empty, because it was still static :)

So my mistake was to remove static modifiers just in some files and not being consistent. The crash is fixed now. I'll check the other files and examples and send you a pull request later.