broken plugin help

Posted By: fab

broken plugin help - 05/25/19 14:26

Hello, Im a zorro beginner. I've recently bought zorro S and Im working on implementing a broker plugin for wcx exchange.
I've managed to implement a few broker plugin functions with no issue. Using TestTrade.c I can connect to the exchange, get my balance, get tradable assets, get prices, send orders etc. This is all done using REST. However wcx encourages the use of WSS rather than REST when it comes to ticking data like prices, and order/trades updates.
So I thought to use libwebsocket for the purpose, and by linking it in, with or without openssl support, zorro does not recognize my dll any more. I cannot see it in the dropdown for the broker selection, but I dont get any error at all, not even something in any log file.
How would I find out what is wrong?
Posted By: AndrewAMD

Re: broken plugin help - 05/25/19 15:21

It's hard to say with this small amount of context. It might depend on how and when that library is getting loaded.

I made a TCP socket plugin, using Boost Asio. If I had to do websockets, I would use Beast + Asio.

I've always needed to make sure that no networking objects were allocated into memory before BrokerLogin is called. Otherwise, the plugin would not be recognized.
Posted By: fab

Re: broken plugin help - 05/28/19 19:33

apologize for the lack of context, but there is not much else I can see.
your suggestion is interesting, I went through my code and Im not directly doing any network object allocation before broker login, however, libwebsocket.h include might declare, but hopefully not define, something that is causing the problem.
when you say "I've always needed to make sure that no networking objects were allocated into memory before BrokerLogin", what was actually preventing zorro from seeing the dll ?
thanks
Posted By: AndrewAMD

Re: broken plugin help - 05/28/19 20:31

No idea, Zorro.exe loads the DLL and then unloads it for reasons I do not understand.

Just play around with your plugin until it works. wink
Posted By: jcl

Re: broken plugin help - 05/29/19 07:52

Zorro first checks if the DLL can be opened with LoadLibrary. If so, it checks if there is a BrokerOpen function and if it returns 2. If both conditions are fulfilled, the DLL is registered and appears in the scrollbox. BrokerLogin is not relevant for registering.

LoadLibrary fails when DllMain uses locks or something like that, or when the DLL relies on another module that's missing. The more complex libraries you're using, the more likely is your DLL to fail on some PCs. Maybe you get details about LoadLibrary requirements on Microsoft forums.

Check your DLL's dependencies with Dependencywalker. Often you can then already see the problem. For debugging, place breakpoints in DllMain and BrokerOpen and check what's happening when Zorro starts.
© 2024 lite-C Forums