On 28 Feb 2005, 15:31:48, Rick Engebretson wrote:
OK, I've updated gpc and begun to probe for "clarification."
I'm glad an automated c-header translator is being discussed. The fpc people have such a tool and have translated libc. A terrific pascal development.
[...]
There is something else which has been exercising me, in respect of imports from Windows DLLs. In gcc, I can do something like this:
FARPROC foo; /*pointer to DLL function "char *foo (char *x, char * y, int z)" */
void main(){ char *str; HINSTANCE h = LoadLibrary ("myfoo.dll"); if (h > 0) { foo = GetProcAddress (h, "foo@12"); str = foo ("foo", "bar", 24); } }
In GPC, this kind of thing will (naturally) not work, because the (function) pointer "foo" cannot be passed arbitrary parameters like that. gcc happily accepts it (now, of course, if the parameters are wrong, then the program will GPF at the call "str = foo ...", and if the parameters are correct, then everything works correctly).
The question is: since GPC is based on gcc, is the capacity to accept something like this present in GPC? (the question whether it should be accepted of is of course a different thing). I personally would find it very useful (not for translating c headers, but for automated parsing of DLLs and automated imports of their exported symbols), although I can hear all the cries of "Pascal is a safe language and therefore should never accept something like this".
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/