我是创建 dll 文件的初学者。我一直在到处搜索,但几乎没有找到帮助,可能是因为这是一个基本的事情?我想知道我是否总是需要编写头文件来创建 dll 文件?我已经根据互联网上的一些帮助编写了 .cpp 文件。我已经构建了它并且很好,但是目录中没有 .lib 文件,所以我想知道这是因为我还没有为 dll 创建头文件吗?如果是的话,你能帮我为我的代码写一个吗?这是我的 .cpp 代码。这是球体代码的简单表面积和体积计算。
// myfirstdll.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include "math.h" //library that defines the pow function
#define M_PI 3.14159 //declare our M_PI constant
/*BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
return TRUE;
}*/
//Function declarations
extern "C" __declspec(dllexport) int __cdecl GetSphereSAandVol(double radius, double* sa, double* vol);
double GetSA(double radius);
double GetVol(double radius);
__declspec(dllexport) int __cdecl GetSphereSAandVol(double radius, …Run Code Online (Sandbox Code Playgroud)