Comments (6)
Were you ever able to solve this?
from boost.application.
@kirbyfan64 could you please confirm this issue on latest master?
from boost.application.
Looks like it...if I build in debug instead, I get:
Assertion failed: px != 0, file C:\boost_1_65\boost/smart_ptr/shared_ptr.hpp, line 734
I'll check out a debugger for an actual traceback...
from boost.application.
Traceback:
* thread #4, stop reason = breakpoint 1.3
frame #0: 0x5887ea40 ucrtbased.dll`abort
frame #1: 0x588830dd ucrtbased.dll`_get_wide_winmain_command_line + 7549
frame #2: 0x58882d89 ucrtbased.dll`_get_wide_winmain_command_line + 6697
frame #3: 0x5888142d ucrtbased.dll`_get_wide_winmain_command_line + 205
frame #4: 0x588833fa ucrtbased.dll`_wassert + 26
frame #5: 0x009ce493 simple_server_application.exe`boost::detail::win32::handle_manager::operator void *(void)const + 579
* frame #6: 0x009b1484 simple_server_application.exe
frame #7: 0x009b2234 simple_server_application.exe
frame #8: 0x009e70be simple_server_application.exe`void boost::thread::yield(void) + 7422
frame #9: 0x009e6fe0 simple_server_application.exe`void boost::thread::yield(void) + 7200
frame #10: 0x009e6e8d simple_server_application.exe`void boost::thread::yield(void) + 6861
frame #11: 0x009e7128 simple_server_application.exe`void boost::thread::yield(void) + 7528
frame #12: 0x76f48744 kernel32.dll`BaseThreadInitThunk + 36
frame #13: 0x7797582d ntdll.dll`RtlGetAppContainerNamedObjectPath + 253
frame #14: 0x779757fd ntdll.dll`RtlGetAppContainerNamedObjectPath + 205
Yes, this sucks, but I can't get lldb to read pdb info, and I'm still trying to get a Clang build working...
from boost.application.
I tried the example from readme in common mode and it did not crash for me. (VS2015, VS2017)
Click to expand
#define BOOST_APPLICATION_FEATURE_NS_SELECT_BOOST
#include <iostream>
#include <fstream>
#include <boost/application.hpp>
using namespace boost;
// my application code
class myapp
{
public:
myapp(application::context& context)
: context_(context)
{
}
void worker()
{
// my application behaviour
// dump args
std::vector<std::string> arg_vector =
context_.find<application::args>()->arg_vector();
my_log_file_ << "-----------------------------" << std::endl;
my_log_file_ << "---------- Arg List ---------" << std::endl;
my_log_file_ << "-----------------------------" << std::endl;
// only print args on screen
for(std::vector<std::string>::iterator it = arg_vector.begin();
it != arg_vector.end(); ++it) {
my_log_file_ << *it << std::endl;
}
my_log_file_ << "-----------------------------" << std::endl;
// run logic
boost::shared_ptr<application::status> st =
context_.find<application::status>();
for(int count = 0; st->state() != application::status::stopped && count < 50; ++count)
{
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
if(st->state() == application::status::paused)
my_log_file_ << count << ", paused..." << std::endl;
else
my_log_file_ << count << ", running..." << std::endl;
}
}
// param
int operator()()
{
std::string logfile
= context_.find<application::path>()->executable_path().string() + "/log.txt";
my_log_file_.open(logfile.c_str());
my_log_file_ << "Start Log..." << std::endl;
#if 0
// launch a work thread
*boost::thread thread(&myapp::worker, this);
context_.find<application::wait_for_termination_request>()->wait();
#else
// to run direct
worker();
#endif
return 0;
}
// windows/posix
bool stop()
{
my_log_file_ << "Stoping my application..." << std::endl;
my_log_file_.close();
return true; // return true to stop, false to ignore
}
// windows specific (ignored on posix)
bool pause()
{
my_log_file_ << "Pause my application..." << std::endl;
return true; // return true to pause, false to ignore
}
bool resume()
{
my_log_file_ << "Resume my application..." << std::endl;
return true; // return true to resume, false to ignore
}
private:
std::ofstream my_log_file_;
application::context& context_;
};
int main(int argc, char *argv[])
{
application::context app_context;
// auto_handler will automatically add termination, pause and resume (windows) handlers
application::auto_handler<myapp> app(app_context);
// my server aspects
// to handle args
app_context.insert<application::args>(
boost::make_shared<application::args>(argc, argv));
// my server instantiation
boost::system::error_code ec;
int result = application::launch<application::common/*server*/>(app, app_context, ec);
if(ec)
{
std::cout << "[E] " << ec.message()
<< " <" << ec.value() << "> " << std::endl;
}
return result;
}
from boost.application.
@kirbyfan64 @AldrichChen Could you please confirm that issue is gone, or provide MCVE for the issue?
Thank you.
P.S.
Example of MCVE here.
from boost.application.
Related Issues (20)
- Mingw: 'LOAD_LIBRARY_SEARCH_APPLICATION_DIR' was not declared in this scope HOT 3
- Mingw 4.8.0: Shared-Library-Loading in Tests fail HOT 3
- including boost/application/context.hpp in multiple translation units in single project will cause linking error HOT 4
- Problem with windows service HOT 8
- Shared library discussion HOT 10
- Implement obtaining a PID HOT 2
- Test case 'aspect_map_test' fail
- simple_server_application_with_auto_handler C++x11 don't compile HOT 2
- wait_for_termination_request (posix), default way bug (ubuntu 14.4) HOT 1
- Add install instructions to readme please HOT 1
- new (live) boost version support
- Which version currently in master branch? HOT 2
- Travis-CI failed with boost master
- issue with signal_handler HOT 3
- BOOST_USE_WINAPI_VERSION is not honored HOT 5
- selfpipe example compilation error HOT 1
- tutorial 4 compilation error HOT 1
- boost.application set 'LOG_DEBUG' to 7 HOT 2
- Boost.Application HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boost.application.