该dll在c++里面可以成功调用。
dll的.h:
#pragma once
#ifdef FILE_RW_DLL_EXPORTS
#define FILE_RW_DLL_API extern "C"__declspec(dllexport)
#else
#define FILE_RW_DLL_API extern "C"__declspec(dllimport)
#endif
#include "stdafx.h"
double __stdcall add(double a, double b);
dll的.cpp:
#include "stdafx.h"
#include "file_rw_dll.h"
double __stdcall add(double a, double b)
{
return (a+b);
}
python调用程序:
import ctypes
filedll=ctypes.WinDLL("file_rw_dll.dll")
print(filedll.add(1,2))
在c++中调用该生成的dll没有问题,python中调用出现“AttributeError: function 'add' not found”
求教!