Prof A Olowofoyeku (The African Chief) wrote:
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/
I'm not going to pretend expertise here.
But one irony comes to mind. Early Windows(eg; 3.0) passed "pascal parameters" to C lib functions and required their declaration as such. So we have come full circle.
Reading more of the "old" GPC manual finds mention of using the "CString" type in place of the "PChar" type. To me (GPC newbie) this is a necessary link between the two languages.