Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!rochester!pt.cs.cmu.edu!andrew.cmu.edu!bader+ From: bader+@andrew.cmu.edu (Miles Bader) Newsgroups: comp.sys.amiga Subject: Re: Prototyping function pointers Message-ID: Date: 2 May 89 21:39:39 GMT References: <14424@louie.udel.EDU> Organization: Information Technology Center, Carnegie Mellon, Pittsburgh, PA Lines: 42 In-Reply-To: <14424@louie.udel.EDU> AXDRW%ALASKA.BITNET@cunyvm.cuny.edu (Don R. Withey) writes: > How does one prototype a function pointer in Lattice 5.02? I have a function > pointer that I want to force Lattice to pass the arguments in certain > registers. For example: ... > Now if I want to do the same thing, except MyFunc is a function pointer, > how do I do it? > > extern __far __asm MyFunc(register __a0 struct Window *); > ... > { > __fptr MyFunc; > ... > MyFunc = SetFunction(...); > ... > MyFunc(Win); > ... > } > > This doesn't work that way I want it to, it basically does the following: ... Your code isn't quite clear, but declaring a local variable with the same name as a function declaration WON'T make the variable inherit the function's attributes. You probably want something like: { /* the declaration of func specifies all the desired attributes */ void __far __asm (*func)(register __a0 struct Window *); /* ... */ func=SetFunction(...); (*func)(Win); /* ... */ } -Miles