我正在尝试创建一个可以记录您的声音并播放它的dll,但是它使用了外部库(SFML),所以我不得不__declspec(dllimport),但是我不能访问变量,因为它给出了错误“ Unresolved外部符号
#include<Windows.h>
#include<SFML/Audio.hpp>
#include<chrono>
#include<thread>
__declspec(dllimport) sf::SoundBufferRecorder recorder;
__declspec(dllimport) sf::SoundBuffer buffer;
__declspec(dllimport) sf::Sound sound;
extern "C" __declspec(dllexport) void Record()
{
recorder.start();
}
extern "C" __declspec(dllexport) void Play()
{
recorder.stop();
buffer = recorder.getBuffer();
sound.setBuffer(buffer);
sound.play();
}