snikulov's picture

Hi,

I've got another issue with PION_STATIC_LINKING on linux (gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)).

I've write custom WebService and want to make it statically linked into binary.
I've implemented simple MjpegService and add PION_DECLARE_PLUGIN(MjpegService) into main(). Also I've enabled PION_STATIC_LINKING in PionConfig.hpp

On WinXP/msvc 8 all compiles just fine, but on Linux box I've received following issue:

/home/snikulov/SVN/my_wbranch/src/stream_hub/src/stream_hub.cpp: At global scope:
/home/snikulov/SVN/my_wbranch/src/stream_hub/src/stream_hub.cpp:48: error: invalid conversion from ‘MjpegService* (*)()’ to ‘void*’
/home/snikulov/SVN/my_wbranch/src/stream_hub/src/stream_hub.cpp:48: error: initializing argument 2 of ‘pion::StaticEntryPointHelper::StaticEntryPointHelper(const std::string&, void*, void*)’
/home/snikulov/SVN/my_wbranch/src/stream_hub/src/stream_hub.cpp:48: error: invalid conversion from ‘void (*)(MjpegService*)’ to ‘void*’
/home/snikulov/SVN/my_wbranch/src/stream_hub/src/stream_hub.cpp:48: error: initializing argument 3 of ‘pion::StaticEntryPointHelper::StaticEntryPointHelper(const std::string&, void*, void*)’
/home/snikulov/SVN/my_wbranch/src/stream_hub/src/stream_hub.cpp: In function ‘int main(int, char**)’:

I've fixed it with explicit cast to void* in PION_DECLARE_PLUGIN

diff for details (from my internal svn):
svn diff ../include/pion/PionPlugin.hpp -r970:971
Index: ../include/pion/PionPlugin.hpp
===================================================================
--- ../include/pion/PionPlugin.hpp (revision 970)
+++ ../include/pion/PionPlugin.hpp (revision 971)
@@ -417,7 +417,7 @@
class plugin_name; \
extern "C" plugin_name *pion_create_##plugin_name(void); \
extern "C" void pion_destroy_##plugin_name(plugin_name *plugin_ptr); \
- static pion::StaticEntryPointHelper helper_##plugin_name(#plugin_name, pion_create_##plugin_name, pion_destroy_##plugin_name);
+ static pion::StaticEntryPointHelper helper_##plugin_name(#plugin_name, (void*)pion_create_##plugin_name, (void*)pion_destroy_##plugin_name);

/// used by PION_DECLARE_PLUGIN to add an entry point for static-linked plugins
class StaticEntryPointHelper {

dinkar31dec's picture
When i discovered that

When i discovered that acquiring a massage is usually the obvious way to decrease constant worry. If you challenge, you will want to use a particular erotic massage and also reserve a scheduled visit with each of your favourite escort. Spots various other back links Over heard you will see effective, ensuring your company consist of relevant back links so that you can escorts and even erotic massage, which means that play them when it's possible to. houston erotic massage los angeles escorts miami escorts escort atlanta los angeles escort new york escorts independent exotic massage miami escort boston escorts dallas escorts atlanta escorts in new york los angeles erotic massage escort in chicago escorts chicago escort houston boston prostitutes exotic massage atlanta exotic massage las vegas las vegas prostitutes houston prostitutes erotic massages new york dallas massage parlor las vegas escort independent escort in dallas massage parlors chicago miami escorts independent exotic massage boston

Submitted by dinkar31dec on Fri, 09/03/2010 - 07:25.
answer's picture
Take a good MBT shoes is

Take a good MBT shoes is amazing.Some kinds of MBT shoes don't actually require breaking in,Mbt sandals made out of leather and you have to wear them.There are some cheap mbt shoes clearance on mbtstore.org,such as mbt habari sandals,mbt shoes kisumu sandals,mbt chapa,mbt fora sandals.We also provide timberland boots and good quality moncler jackets.Many technological advances in the moncler and also in timberland boots uk.Moncler jacket so have designed the wears. You would not only stay warm but also will look up to moncler down jackets which can keep a person warm during the freezing iciness.timberland boots sale had been chosen to be the official manufacturer.Moncler 2010 is hot sale.answer

Submitted by answer (not verified) on Tue, 08/24/2010 - 04:59.
czq's picture
Do you want to purchase

Do you want to purchase jerseys? There are online jerseys shops, like as nfl jerseys, nfl jackets and nfl shirts, as the online shops becoming more and more popular , so the shops have kinds of products, for example jimmy choo handbags , gucci handbags and ugg boots, many people want to  buy discount jimmy choo bags. there’re various web shop nfl clothing, but we don’t know how choice best one. Jerseyell.com is a great place we can buy our lovely mbt shoes I hope in my birthday mother can send me a jimmy choo handbag, also I hope my friend send me bags. Like jimmy choo bags for my love.

Submitted by czq (not verified) on Mon, 08/23/2010 - 02:07.
Mike Dickey's picture
Static modules don't require PION_STATIC_LINKING

With the 0.5.4 release, the code for handling dynamic plugin modules was split out from "HTTPServer" into a "WebServer" class. HTTPServer now lets you bind function objects to resources, allowing you to use static linking without the old PION_STATIC_LINKING macros. For example:

void staticFuncToHandleRequests(HTTPRequestPtr& req_ptr, TCPConnectionPtr& conn_ptr)
{ ... }
...
HTTPServer my_server;
my_server.addResource("/", boost::bind(&staticFuncToHandleRequests, _1, _2));
...

I think this is a much cleaner and easier approach that provides the same functionality and replaces the need for PION_STATIC_LINKING. I'm open to hear arguments to the contrary, but for now I see no reason why we shouldn't remote it.

(Note: a Drupal upgrade gone bad ate my last post, so I had to re-write this response)

Submitted by Mike Dickey on Tue, 07/22/2008 - 14:19.
Mike Dickey's picture
Remove PION_STATIC_LINKING?

I'm actually thinking about removing all the STATIC_PLUGIN code.

I don't believe that this feature is relevant now that HTTPServer and WebServer are split out as two separate classes (with the former allowing resources to be bound to any function/object, and the latter adding code for dynamic modules or plugins). I think that the same functionality can be achieved (and in a much cleaner/more standard way) by using HTTPServer instead of WebServer, and linking the cpp files into your application.

Please correct me if I'm missing something here, but unless there are major objections I plan to remove this code from the next release.

Submitted by Mike Dickey on Mon, 07/21/2008 - 15:56.
snikulov's picture
But currently it present and

But currently it present and does not work as I'm expected from the PionWebServer.cpp example ;-) And only on Linux, where gcc does not doing automatic casting to void*

Dynamic modules (I think so) not quite good for embedded devices. So options for make modules dynamic/static during compilation is valuable options for it.

Submitted by snikulov on Mon, 07/21/2008 - 19:09.