Answer the question
In order to leave comments, you need to log in
Why does exe and dll code work differently?
When I build an exe with this code, everything works fine:
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <cstdlib>
#include <iostream>
#include <string>
namespace beast = boost::beast; // from <boost/beast.hpp>
namespace http = beast::http; // from <boost/beast/http.hpp>
namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp>
namespace net = boost::asio; // from <boost/asio.hpp>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
net::io_context ioc;
websocket::stream<tcp::socket> ws{ ioc };
// Sends a WebSocket message and prints the response
int main(int argc, char** argv)
{
try
{
// Check command line arguments.
std::string host = "192.168.1.104";
auto const port = "3001";
auto const text = "Hello, world!";
// The io_context is required for all I/O
//net::io_context ioc;
// These objects perform our I/O
tcp::resolver resolver{ ioc };
//websocket::stream<tcp::socket> ws{ ioc };
// Look up the domain name
auto const results = resolver.resolve(host, port);
// Make the connection on the IP address we get from a lookup
auto ep = net::connect(ws.next_layer(), results);
// ну и т.д.
#include "stdafx.h"
#include "Project2.h"
#include "Header1.h"
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <cstdlib>
#include <iostream>
#include <string>
namespace beast = boost::beast; // from <boost/beast.hpp>
namespace http = beast::http; // from <boost/beast/http.hpp>
namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp>
namespace net = boost::asio; // from <boost/asio.hpp>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
// Reads the storage
net::io_context ioc;
websocket::stream<tcp::socket> ws{ ioc };
PROJECT2_API void connect(void) {
std::string host = "192.168.1.104";
auto const port = "3001";
auto const text = "Hello, world!";
//net::io_context ioc;
//websocket::stream<tcp::socket> ws{ ioc };
// The io_context is required for all I/O
//net::io_context ioc;
// These objects perform our I/O
tcp::resolver resolver{ ioc };
//ws{ ioc };
// Look up the domain name
auto const results = resolver.resolve(host, port);
// Make the connection on the IP address we get from a lookup
auto ep = net::connect(ws.next_layer(), results);
// ну и т.д.
net::io_context ioc;
websocket::stream<tcp::socket> ws{ ioc };
namespace beast = boost::beast; // from <boost/beast.hpp>
namespace http = beast::http; // from <boost/beast/http.hpp>
namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp>
namespace net = boost::asio; // from <boost/asio.hpp>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
// Reads the storage
PROJECT2_API void connect(void) {
std::string host = "192.168.1.104";
auto const port = "3001";
auto const text = "Hello, world!";
net::io_context ioc;
websocket::stream<tcp::socket> ws{ ioc };
// The io_context is required for all I/O
//net::io_context ioc;
// These objects perform our I/O
tcp::resolver resolver{ ioc };
//ws{ ioc };
// Look up the domain name
auto const results = resolver.resolve(host, port);
// Make the connection on the IP address we get from a lookup
auto ep = net::connect(ws.next_layer(), results);
// ну и т.д.
Answer the question
In order to leave comments, you need to log in
Because the program is executed completely, and from DDL only the function that you call.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question