[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] non static libs on windows (dll)

From: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-03-21 09:55:39 CET

Branko Cibej wrote:
> Because the __declspec has to come before the type, and the __stdcall
> after the type.

Really? The following works for me on VC6

  int __declspec(dllexport) __stdcall whatwhat()
  {
    return 0;
  }

But you are right about __stdcall having to come after the return type, so
my example in the previous post couldn't work.

Anyway, on the bigger issue I think the best alternatives are:

1) Use __cdecl and DEF files. The advantages are that it doesn't require any
modifications to the source, that it might lead to slightly faster load
times if ordinals are specified, and that __cdecl is the default calling
convention for C and C++, so programmers wouldn't have to specify it
explicity or wonder which convention to use.

2) Use __stdcall and __declspec() . The advantages are that __stdcall
function calls are smaller and faster than __cdecl calls, that explicit
__declspec(dllimport) declarations allow the compiler to further optimise
calls (by eliminating a level of indirection), and that __stdcall is the
default calling convention for most languages other than C and C++, so
programmers using these languages wouldn't have to specify it explicity or
wonder which convention to use.

Either one seems reasonable to me...

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 21 09:55:08 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.