Why do we need dynamic binding (via GetProcAddress32)? We don't check return
values. So if any of these functions are not exported, function pointer will
be set to NULL, and we have a good chance to crush application in the
middle.
If we will use static binding (via Import section) we at least will get
"unresolved external" error at load time.
Maybe I missed something and "Import" doesn't work in ELF-PE / ELF-ELF
binding?
Anyway, if we stick to current approach I think we must check return value
of GetProcAddress.
Another question / suggestion. Why don't we put all imported function
pointers into array? This will simplify COMDLG32_DllEntryPoint (especially
if we gonna check pointers for null).
Something like:
---
const char *func_names[N] = {"func1", "func2", ...}
union {
FUNCPTR ptr[N];
struct {
void (WINAPI *func1)(void);
void (WINAPI *func2)(void);
....
} u1;
} extdll;
---
so loading will look like:
---
for (i = 0; i < N; i++)
{
extdll.ptr[i] = (FUNCPTR)GetProcAddress32 (extdllHandle, func_names[i]);
if (extdll.ptr[i])
return FALSE;
}
---
And instead of COMDLG32_func1();
we will have extdll.func1();
As far as I inderstand this will not create extra cost for function calls.
--
Serge Ivanov
[EMAIL PROTECTED]
--
The address in the headers is not the poster's real email address. Do not send
private mail to the poster using your mailer's "reply" feature. CC's of mail
to mailing lists are OK. Problem reports to "[EMAIL PROTECTED]".
The poster's email address is "[EMAIL PROTECTED]".