小编tee*_*s99的帖子

如何获得与Visual Studio一起使用的Boost库二进制文件?

这是一个你可能已经看到的各种形式的网络问题...总结在这里为你google搜索乐趣:-)

我有一个使用Microsoft的Visual Studio构建的项目,并使用boost(http://www.boost.org/)的功能.我已经让我的项目使用了一些只是标题的库(没有链接的二进制库).如何或在哪里可以获取其他库的Windows二进制文件?

c++ windows boost visual-studio

13
推荐指数
1
解决办法
2万
查看次数

使用 ctypes 从 python 访问 boost::进程间共享内存块

我在 Windows 上运行的 C++ 程序中有一个结构,我想使用 ctypes 通过 Python 中的共享内存来访问该结构。例如:

#define MAX_ENTITIES 30

struct State
{
   double x;
   double y;
   double z;
};

struct Stat
{
   unsigned int numAvailable;
   unsigned int numUsed;
};

struct TransferData
{
   double exLg;
   float other;
   unsigned int more;
   int more2;
   unsigned char next;
   bool statusReady;

   Stat status;
   State entities[MAX_ENTITIES];
};
Run Code Online (Sandbox Code Playgroud)

作为:

import ctypes

MAX_ENTITIES = 30


class State(ctypes.Structure):
    _fields_ = [
        ('x', ctypes.c_double),
        ('y', ctypes.c_double),
        ('z', ctypes.c_double)
    ]


class Stat(ctypes.Structure):
    _fields_ = [
        ('numAvailable', ctypes.c_uint),
        ('numUsed', …
Run Code Online (Sandbox Code Playgroud)

c++ python boost shared-memory

6
推荐指数
1
解决办法
3186
查看次数

使用 Inno Setup 更快地创建安装程序

当我在大量文件(>2GB)上运行 Inno Setup 时,需要很长时间才能运行。我相信它把时间花在了压缩上,这应该是 CPU 限制的,但它只使用了几个 CPU。有没有办法将其分散到(许多)更多核心?

具体来说,我正在使用这个boost-release 存储库,它有一个 Inno Setup 脚本,其中包括:

[Setup]
....
Compression=lzma2/ultra64
....

[Files]
Source: "boost_1.69.0/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs ignoreversion
....
Run Code Online (Sandbox Code Playgroud)

Compil32.exe boost_installer.iss在具有 16 核和 32GB RAM (Azure F16s v2) 的计算机上,调用大约需要 25 分钟。

该文件集大约为 2.5GB,其中 2GB 是一组大约 300 个编译库。剩余的 500MB 是 60,000 个源文件。

inno-setup

4
推荐指数
1
解决办法
3113
查看次数

使用线程调用 Py_Finalize 时出现断言错误(仅限 3.X)

当我从不同的 C 线程调用 C-API 的 Py_Finalize() 而不是我进行 python 调用时,我得到一个错误输出。

我看到的错误是:

Exception ignored in: <module 'threading' from 'C:\\Python34-32\\Lib\\threading.py'>
Traceback (most recent call last):
  File "C:\Python34-32\Lib\threading.py", line 1289, in _shutdown
    assert tlock.locked()
AssertionError:
Run Code Online (Sandbox Code Playgroud)

这只发生在 Python 3.X(用 3.4.2 测试)中,在 Python 2.7 中完全相同的代码没有任何问题。

这是一个最小的例子,它显示了在使用 C 线程时发生的情况,但不是当所有事情都发生在单个 c 线程上时:

#include <iostream>
#include <fstream>
#include <thread>
#include <cassert>

#include <Python.h>

void make_file()
{
   std::fstream file("my_test.py", std::ios::out);
   file << 
      "import threading\n"   << 
      "def my_function():\n" << 
      "    pass\n"             ;
   file.close();
}

void exec()
{
   PyGILState_STATE gstate = PyGILState_Ensure(); …
Run Code Online (Sandbox Code Playgroud)

c++ python python-c-api python-c-extension python-3.x

3
推荐指数
1
解决办法
2532
查看次数