Ctypes:s错误:异常:s

2024-05-29 00:21:48 发布

您现在位置:Python中文网/ 问答频道 /正文

问题解决了。函数名重复。

是的。你知道吗

C++ +EH3>

此代码在exe中工作,但在使用python时不在dll中工作。你知道吗

当程序运行到dec(&buffer2, &length, &buffer);时,Python抛出此错误。你知道吗

python和dll都是x64。你知道吗

#include "Decompress.h"
#pragma comment (lib,"Decompress.lib")

#define DLLEXPORT extern "C" __declspec(dllexport)

DLLEXPORT void try_dec() 
{
    int buffer[20];
    int buffer2[20];
    int length = 20;

    dec(&buffer2, &length, &buffer);

    return;
}

Python

import ctypes

dll = ctypes.CDLL('Dec.dll')
dll.try_dec()

错误

    dll.dec()
OSError: exception: stack overflow

Tags: 函数代码libbuffer错误ctypesdecompresslength

热门问题