Créer une DLL – Windows

Structure

| Love.cpp
| Love.h
| pch.h 
| pch.cpp
| framework.h

Code

// Love.h - Function to handle love request

#pragma once

//Visual Studio defines <PROJECTNAME>_EXPORTS when your MathLibrary DLL project is built.
#ifdef LOVE_EXPORTS
#define LOVE_API __declspec(dllexport) //tells the compiler and linker to export a function or variable from the DLL for use by other applications
#else
#define LOVE_API __declspec(dllimport) //optimizes the import of the function or variable in an application
#endif


extern "C" LOVE_API const char* StoreLove(const char* b64);

extern "C" LOVE_API const char* GetLove(const int number);
// Love.cpp : Defines the exported functions for the DLL.

#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include "Love.h"
#include <iostream>

// DLL internal state variables:
static unsigned int count = 500; 



const char* StoreLove(const char* b64) {
	return "Your love is safe !";
}

const char* GetLove(const int number) {
	const char* UwU = "<3";
	count--;
	return UwU;
}

Ressources