public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34112]  New: Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL
@ 2007-11-15 18:23 burnus at gcc dot gnu dot org
  2007-11-15 19:25 ` [Bug fortran/34112] " burnus at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-15 18:23 UTC (permalink / raw)
  To: gcc-bugs

32bit Windows uses a different calling convention (called procedure pops the
stack, not caller) with a symbol name _<name>@n, where n is the number of bytes
to pop off.

See also:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/19d77dfc75f8be58
http://gcc.gnu.org/ml/fortran/2007-11/msg00074.html

As the standard makes not provisions and !DEC$ (*DEC$, cDEC$) is widely used,
gfortran should accept the following:

  function CallWndRetProc(nCode, wParam, lParam)
  !DEC$ ATTRIBUTES STDCALL,DECORATE, ALIAS: 'CallWndRetProc' :: CallWndRetProc 
  end function

Documentation:
http://www.intel.com/software/products/compilers/docs/fmac/doc_files/source/extfile/lref_for/source_files/rfattcst.htm
http://www.intel.com/software/products/compilers/docs/fmac/doc_files/source/extfile/lref_for/source_files/rfattrib.htm

They seem to map to
(http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html):

STDCALL  ->  __attribute__(stdcall)
ALIAS    ->  __attribute__(alias("name"))
DECORATE -> ?

The problem with decorate is that its meaning depends on the platform. It may
decorate the "name" of alias with a "_" prefix and "@n" postfix or only with a
"_" prefix. Maybe one should start with STDCALL and ALIAS.

For alias one should do something as in c-pragma.c's apply_pragma_weak:

decl_attributes (&decl, build_tree_list (get_identifier ("alias"),
                                         build_tree_list (NULL, value)),
                 0);


-- 
           Summary: Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34112


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-06-28 19:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-15 18:23 [Bug fortran/34112] New: Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL burnus at gcc dot gnu dot org
2007-11-15 19:25 ` [Bug fortran/34112] " burnus at gcc dot gnu dot org
2007-11-16 23:09 ` dannysmith at users dot sourceforge dot net
2007-11-18 21:49 ` tkoenig at gcc dot gnu dot org
2008-02-05 10:18 ` fxcoudert at gcc dot gnu dot org
2008-02-05 15:12 ` burnus at gcc dot gnu dot org
2008-03-03 14:41 ` burnus at gcc dot gnu dot org
2008-03-04 22:21 ` burnus at gcc dot gnu dot org
2008-04-04  7:49 ` burnus at gcc dot gnu dot org
2008-04-04  8:35 ` fxcoudert at gcc dot gnu dot org
2009-06-16 14:22 ` burnus at gcc dot gnu dot org
2009-06-16 16:36 ` burnus at gcc dot gnu dot org
2009-06-28 17:57 ` burnus at gcc dot gnu dot org
2009-06-28 19:51 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).