[comp.lang.c] Extended keywords in 80x86-family C's

gwollman@tnl.UUCP (Garrett A. Wollman) (06/29/89)

I am attempting to create a VFOSSIL interface library in C, and I am having
some difficulties in figuring out where to place the extended keywords,
far and pascal, about which the Microsoft _C Language Reference_ has
very little to say.

Basically, I need to declare a pointer to a far pointer to a far pascal
function.  I started out with two possibilities (which compile), who
knows which is correct:
 

int (far pascal **f00)(int)

or

int (** far pascal f00)(int)

Under my interpretation, the first ought to give a far pascal pointer to
a pointer to a near cdecl function returning an int.  The second seems
to be a pointer to a pointer to a function returning int, which resides
in the far data segment (FAR_DATA) and uses the pascal naming convention
(i.e. F00 instead of _f00).
Neither of these looks like what I want.

I also tried:

int (* far pascal *f00)(int)

But the compiler gave me the response, "Keyword pascal not allowed in
pointer to data," whatever that means.

So, can anybody figure out what would be the proper declaration?  I am
at a loss at this point.

-GAWollman

-- 
"(-::-)"    (Siamese twins)   | "This is a public-access system, so I don't 
gwollman@tnl.UUCP             |  know what the operator's opinions are."
             ...uunet!uvm-gen!tnl!gwollman

beng@microsoft.UUCP (Samurai Cat) (07/02/89)

In article <213@tnl.UUCP> gwollman@tnl.UUCP (Garrett A. Wollman) writes:
| 
| Basically, I need to declare a pointer to a far pointer to a far pascal
| function. 

Try
	int (pascal far * *f00)(int);

which works for me (using MS C 5.10).  Usage example:

	int (pascal far * *f00)(int) = NULL;
	int (pascal far *funcptr)(int) = NULL;

	extern int far pascal catbox( int );

	void no_means_no( void )
	{
		funcptr = catbox;
		f00 = &funcptr;
	}

This will compile into something suspiciously similar to

	mov	WORD PTR _funcptr, OFFSET CATBOX
	mov	WORD PTR _funcptr+2, SEG CATBOX

	mov	WORD PTR _f00, OFFSET DGROUP:_funcptr

(modulo sticky func-call residue)

--
Ben Goetter			microsoft!beng
standard funky disclaimers in full effect, etc., etc.