Hi, I need to be able to call a function from all the C++ files included in my project and i am not sure how to do it.. everytime i try something (such as exporting a class or function) i get multiple function declaration errors and it fails to compile, i have been trying to get this to work for the last two weeks and have tried everything, i must be missing something..
my program structure looks like this:
main.cpp - main() - where callfunc() is called for every file..
file1.cpp - __declspec(dllexport) void callfunc()
file2.cpp - __declspec(dllexport) void callfunc()
file3.cpp - __declspec(dllexport) void callfunc()
when my program starts, i want to be able to have the callfunc() function in file1.cpp, file2.cpp, and file3.cpp called after main()
in a nut shell, every C++ file that is included in my project that has the void callfunc() function, i need my program to call it when it starts up so that each file can do its own intalisation
i have tried exporting a class using extern "C" and then the class name and the callfunc() there as a virtual void function, but that fails to work, and i have tried using init() but for some reason the data that is set in the callfunc() function is destroyed after the function finishes.. so that is out of the question
the reason why i want to do this, is for plugin support via source.. and i cant find any good resources on the subject, i am not asking for someone to code it for me, i just dont know what to do... thanks for any help or suggestions in advance.