+CAPTIVE_CDECL
authorshort <>
Mon, 4 Nov 2002 23:28:10 +0000 (23:28 +0000)
committershort <>
Mon, 4 Nov 2002 23:28:10 +0000 (23:28 +0000)
+CAPTIVE_STDCALL

doc/FAQ
src/libcaptive/include/captive/Makefile.am
src/libcaptive/include/captive/calltype_reactos.h [new file with mode: 0644]
src/libcaptive/include/reactos/compat.h

diff --git a/doc/FAQ b/doc/FAQ
index 745eafb..620eaed 100644 (file)
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -188,7 +188,7 @@ A: W32 uses
    function generated inside libcaptive/ke/exports.c file named
    functionname_calltype (such as functionname_fastcall etc.).
 
-   Realying function are generated as:<dl>
+   Relaying function are generated as:<dl>
    <dt>cdecl</dt><dd>No relaying function generated, just a simple #define.
        You won't see this function in the gdb backtrace.
        We cannot generate it by C code as we do not know the number of its arguments.
@@ -210,6 +210,19 @@ A: W32 uses
    32-bit return value in EAX is always passed back although it may be vain.
    Please see the documentation of "captivesym.pl" for more information.
 
+   Unfortutely the situation is dense during calling from the standard
+   call type forced captive/reactos to the foreign binary W32 code as this
+   code we cannot recompile in any way. All function prototypes leading
+   to the W32 binary code are declared by CAPTIVE_CDECL or CAPTIVE_STDCALL
+   macros from "captive/calltype_reactos.h". These macros have to be
+   #ifdef-ed inside reactos code as they are not available during standalong
+   reactos compilation. CAPTIVE_FASTCALL is not provided but it should not be
+   needed as the non-core kernel code inside foreign W32 binaries usually
+   does not provide any FASTCALL functions. There may be problem if some
+   internal reactos code gets compiled while being called through
+   CAPTIVE_CDECL or CAPTIVE_STDCALL declared protypes - there is currently
+   no such case known.
+
 Q: Why do you call the platform "W32"?
 A: http://mail.gnu.org/pipermail/libtool/2000-September/000110.html
 
index 4c06554..7afbf55 100644 (file)
@@ -20,6 +20,7 @@ include $(top_srcdir)/Makefile-head.am
 include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
 
 pkginclude_HEADERS+= \
+               calltype_reactos.h \
                client.h \
                file.h \
                ldr.h \
diff --git a/src/libcaptive/include/captive/calltype_reactos.h b/src/libcaptive/include/captive/calltype_reactos.h
new file mode 100644 (file)
index 0000000..44586e0
--- /dev/null
@@ -0,0 +1,75 @@
+/* $Id$
+ * Include file for function call types definitions for reactos files for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_CALLTYPE_REACTOS_H
+#define _CAPTIVE_CALLTYPE_REACTOS_H 1
+
+
+#include <glib/gmacros.h>
+/* captive/?*_reactos.h include files have forbidden any reactos/?* inclusions
+ * as they are being included by reactos/compat.h.
+ */
+
+
+G_BEGIN_DECLS
+
+/**
+ * CAPTIVE_CDECL:
+ *
+ * Function call type declaration for the real #CDECL call type.
+ * As the default #CDECL macro gets disabled (=NOP) during reactos sources
+ * compilation (and gets undefined to cause error during non-reactos sources
+ * compilation) you have the chance to do the real #CDECL declaration
+ * by using #CAPTIVE_CDECL. You must #ifdef it by %LIBCAPTIVE symbol as it
+ * is not available during standalone reactos compilation.
+ *
+ * This macro may be needed to pass control to W32 binary code.
+ */
+#define CAPTIVE_CDECL    __attribute__((__cdecl__))
+
+
+/**
+ * CAPTIVE_STDCALL:
+ *
+ * Function call type declaration for the real #STDCALL call type.
+ * As the default #STDCALL macro gets disabled (=NOP) during reactos sources
+ * compilation (and gets undefined to cause error during non-reactos sources
+ * compilation) you have the chance to do the real #STDCALL declaration
+ * by using #CAPTIVE_STDCALL. You must #ifdef it by %LIBCAPTIVE symbol as it
+ * is not available during standalone reactos compilation.
+ *
+ * This macro may be needed to pass control to W32 binary code.
+ */
+#define CAPTIVE_STDCALL  __attribute__((__stdcall__))
+
+
+/**
+ * CAPTIVE_FASTCALL:
+ *
+ * You cannot do simple declaration for the real #FASTCALL call type.
+ *
+ * You should not need it as the non-core W32 binary code does not use #FASTCALL
+ * functions.
+ */
+#undef CAPTIVE_FASTCALL
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_CALLTYPE_REACTOS_H */
index 9a30b57..d78868f 100644 (file)
  */
 
 
+/* Define CAPTIVE_CDECL and CAPTIVE_STDCALL call types macros.
+ * They do not need to be undefed as they are common to reactos and non-reactos code.
+ * These macros have to be #ifdef-ed inside reactos itself.
+ */
+#ifdef REACTOS_COMPAT
+#include "captive/calltype_reactos.h"  /* for CAPTIVE_CDECL and CAPTIVE_STDCALL */
+#endif
+
 /* Place AFTER REACTOS_UCS2 definition as there is
  *     internal/debug.h->internal/ntoskrnl.h->ddk/ntddk.h->REACTOS_UCS2()
  * Some sources (reactos/ntoskrnl/ldr/loader.c) define NDEBUG themselves!