I have a dll project (Server.dll) containing a Server.cpp
Server.cpp
#include "pch.h"
#include "Server.hpp"
extern "C" {
    _declspec(dllexport) int Server::Add(int a, int b)
    {
        return a + b;
    }
}
#define Function(  Y )  \
\
extern "C" __declspec( dllexport)\
    std::string Server::Y(std::string const& name) {\
    return name; \
}\
I use these two functions in another project client.exe
Here id the main
#include <Windows.h>
#include <iostream>
typedef int(*pAdd) (int a, int b);
int main()
{
    std::string path = "D:\\project\\Server.dll";
    std::wstring stemp = std::wstring(path.begin(), path.end());
    LPCWSTR sw = stemp.c_str();
    HINSTANCE hinstance = LoadLibrary(sw);
    if(!hinstance)
        std::cout << "canot load library\n";
    pAdd obj = (pAdd)GetProcAddress(hinstance, "Add");
    if (obj) {
        int result = obj(10, 20);
        std::cout << "result = " << result << std::endl;
    }
    std::string func = "Client";
    std::cout << "address = " << GetProcAddress(hinstance, "Y");
}
I can load the Add function but I can't load the Y function (address = 0000000000)
Any suggestions please ?
 
    