Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Binary compatibility of prototyped vs. K&R functions

1 view
Skip to first unread message

Peter Jacobi

unread,
Jun 23, 2003, 4:51:36 AM6/23/03
to
Dear All,

I'm not clear whether this is at all compiler specific but it
seems safer to ask it here.

I'm writing a DLL which gets called by an application not
compiled by me. Among others the DLLs has to provide pointers
to some functions which will in turn called by the app.

In the documentation for DLL writers these functions are
all declared using the old K&R syntax:

extern short mycallback1 ();

/*
...
*/

short mycallback1 (foo, bar baz)
long foo;
short bar;
void *baz;
{
/*...*/
}

My question is, whether it is harmless to change to prototyped
functions, or do the calling conventions differ?

Regards,
Peter Jacobi

Stephen Howe [TeamSybase]

unread,
Jun 27, 2003, 11:16:06 AM6/27/03
to
> My question is, whether it is harmless to change to prototyped
> functions, or do the calling conventions differ?

DLL's for what OS? (Could be 16-bit or 32-bit DLLs for OS/2 or Windows).

If this is Win32, I would definitely change these to __stdcall calling
convention as this is guaranteed to be callable from other applications.

I am amazed that after all these years K&R syntax is used for DLL entry
points and it works.

Stephen Howe [TeamSybase]
London, UK


0 new messages