0

I program in visual studio in C++. I have one project that is a server, and the second project is a DLL that can be uploaded to the server, in order for me to send some special commands through the DLL, I need to pass it a function from the server. I tried exporting functions from server in this way

extern "C" __declspec(dllexport) void send_peer_command(Peer* peer, const std::string& lua_command);

But it doesn't work. So i need to export function from exe file to dll project on C++. I tried a bunch of ways but I didn't succeed, please tell me how to do it. I know this is not the best solution, but I urgently need to do it. I know that there are ways to do this, but there are few examples of this, just if you can give a simple example, that's all I need

James Z
  • 12,209
  • 10
  • 24
  • 44
  • @drescherjm that's not true. you can and it is documented. DLL and EXE are only different in a name, typical use case and OS behaviour about them, they are files of PEXE format. Actually in debug mode native MS compiler does export a few functions for debugging purposes. There are several Windows modules that are both dll, console app AND a service in one. There is this too: https://www.codeguru.com/windows/calling-an-exported-function-in-an-exe-from-within-a-dll/ – Swift - Friday Pie Dec 21 '21 at 14:43
  • 1
    Are you sure you cant use shared memory, inter-process synchronization, IPC or COM for your task? Technically, yes, they are implemented through export/import on lowest level, but there you have developed infrastructure of communucations. – Swift - Friday Pie Dec 21 '21 at 15:07

0 Answers0