From: "Alexander van Vlerken" Newsgroups: comp.os.msdos.djgpp Subject: Help !! Function pointer problem in GPC Date: 31 Jul 1997 12:37:39 GMT Organization: World Access/Planet Internet Message-ID: <01bc9daf$2522b340$13d9dc91@default> NNTP-Posting-Host: 145.220.217.19 Lines: 47 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi, I am experiencing the following problem in gpc, I'm not able to assign and use function pointers. At first I thought I was doing something wrong, but I can't even get gpc to compile the following example which was taken from the gpc docs (file GPC.I7 in the info directory, the example starts at line 993). Here's the example: program zap(output); type proc_ptr = ^ procedure (integer); var pvar : proc_ptr; procedure write_int(i: integer); begin writeln ('Integer: ',i:1); end; begin (* PVAR points to function WRITE_IT *) pvar := &write_int; {This is line 16, where GPC is complaining about} (* Dereferencing a function pointer calls the function *) pvar^(12345); end. And when I want to compile this piece of code, gpc returns the following errormessages: Error: too few arguments to function Write_int (in line 16) Error: invalid lvalue in unary '&' (in line 16) Error: Assigning a restricted type object is not allowed (in line 16) I also tried "pvar := @write_int" (the turbopascal way), but I still get the same errormessages. Does anyone know what I am doing wrong, or perhaps another way to retrieve the address of a function/procedure ? I am using gpc in a djgpp environment in a dos box under Win95. Greetz, Alex van Vlerken (h DOT vlerken AT pi DOT net)