Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Unexpected exit when use Visual Studio 2022

Open
#389 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp, python
Domain
backend

Research direction

Start with dllmain.cpp and the Visual Studio 2022 configuration shown in the issue, then reproduce the vcpkg-built Boost.Python extension by importing Dll1. Check the build and runtime configuration around the DLL import, and consider the issue complete when importing the DLL no longer exits Python and test() can be called.

Written by the indexing model from the issue text.

Description

I installed boost Python on Windows using vcpkg. And I successfully compiled my DLL file, but I don't know why Python always exits automatically after import the dll.
This is my code (dllmain.cpp):

// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"

#include <iostream>
#include <string>
#define BOOST_PYTHON_STATIC_LIB
#include <boost/python.hpp>

using namespace boost::python;

void test() {
	std::cout << "Test" << std::endl;
}

BOOST_PYTHON_MODULE(Dll1)
{
	boost::python::def("test", test);
}

屏幕截图 2022-07-04 164552
屏幕截图 2022-07-04 164750
This is my Visual Studio 2022 Config:
屏幕截图 2022-07-04 164905
屏幕截图 2022-07-04 164926
屏幕截图 2022-07-04 164952

Dominant language
C++
Stars
537
Forks
223
Avg merge
11h 22m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/python

All issues in boostorg/python

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.