This is a code organization question.
I got my basic code working but when I expand it, it will be terrible. I have a DLL which I don't have a .lib
for. Therefore I have to use the whole LoadLibrary()/GetProcAddress()
combo. It works great. But this DLL that I'm referencing has 100+ functions. My current process is:
1) Typedef a type for the function. E.g.: typedef short(_stdcall *type1)(void);
2) Assign a function name that I want to use such as type1 function_1;
3) Load the DLL, then do something like: function_1 = (type1)GetProcAddress(hinstLib, "_mangled_funcName@5");
Normally I would like to do all of my function definitions in a header file but because I have to use the load library function, its not that easy. The code will be a mess. Right now I'm doing (1) and (2) in a header file and was considering making a function in another .cpp file to do the load library and dump all of the (3)'s in there. I considered using a namespace for the functions so I can use them in the main function and not have to pass over to the other function.
Any other tips on how to organize this code? My goals are to be able to use function_1
as a regular function in the main code. If I have to a ref::function_1
that would be okay but I would prefer to avoid it. This code for all practical purposes is just plain C at the moment.