I'm working on a shared library and adding some functions which I export as c functions, so I can use them easily in C#. But none of my c functions are exported.
According to the app DependenciesGUI my c++ functions are exported, but none of my c functions.
I created a test class to demonstrate my problem: TEST_API contains __declspec(dllimport) and export
#pragma once
#include "DLL_Macro.h"
class TEST_API Attempt {
int x;
public:
Attempt(int x);
int adding(int y);
};
extern "C" __declspec(dllexport) void* Create(int x) {
return (void*) new Attempt(x);
};
extern "C" __declspec(dllexport) int AttemptAdd(Attempt * a, int y) {
return a->adding(y);
};
The Solution to the problem was simple: include the header with the extern "C" functions in a source file. In my case in a cpp file of the class.