/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM e:/builds/moz2_slave/mozilla-central-win32-xulrunner/build/js/ctypes/nsIForeignLibrary.idl
 */

#ifndef __gen_nsIForeignLibrary_h__
#define __gen_nsIForeignLibrary_h__


#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsILocalFile; /* forward declaration */


/* starting interface:    nsIForeignLibrary */
#define NS_IFOREIGNLIBRARY_IID_STR "352a72c1-5b99-451e-a330-c45079d8f087"

#define NS_IFOREIGNLIBRARY_IID \
  {0x352a72c1, 0x5b99, 0x451e, \
    { 0xa3, 0x30, 0xc4, 0x50, 0x79, 0xd8, 0xf0, 0x87 }}

/**
 * Interface that wraps a dynamic library and can create
 * callable 'method' objects from exportable functions in the library
 */
class NS_NO_VTABLE NS_SCRIPTABLE nsIForeignLibrary : public nsISupports {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFOREIGNLIBRARY_IID)

  /**
   * ABI constants that specify the calling convention to use.
   * DEFAULT corresponds to the cdecl convention, and in almost all
   * cases is the correct choice. STDCALL is provided for calling
   * functions in the Microsoft Win32 API.
   */
  enum { DEFAULT = 0U };

  enum { STDCALL = 1U };

  /**
   * Types available for arguments and return values, representing
   * their C counterparts.
   */
  enum { VOID = 0U };

  enum { BOOL = 1U };

  enum { INT8 = 2U };

  enum { INT16 = 3U };

  enum { INT32 = 4U };

  enum { INT64 = 5U };

  enum { UINT8 = 6U };

  enum { UINT16 = 7U };

  enum { UINT32 = 8U };

  enum { UINT64 = 9U };

  enum { FLOAT = 10U };

  enum { DOUBLE = 11U };

  enum { STRING = 12U };

  enum { USTRING = 13U };

  /**
   * Attempts to dynamically load the specified library
   */
  /* void open (in nsILocalFile aFile); */
  NS_SCRIPTABLE NS_IMETHOD Open(nsILocalFile *aFile) = 0;

  /**
   * Unloads the currently loaded library. Any subsequent attempts to call
   * functions on this interface will fail.
   */
  /* void close (); */
  NS_SCRIPTABLE NS_IMETHOD Close(void) = 0;

  /**
   * Used to specify an exported method from the currently loaded library. Even
   * though the method appears to take no parameters, it does in fact require
   * several. It uses some XPCOM/JSAPI magic to extract the parameters.
   *
   * declare(in AString aName, in int aABI, in int aReturnType, in int aArgType1, ...)
   *
   * The resulting object can then be used to call the underlying
   * C function like so:
   *
   * var retval = nativeMethod(arg1, arg2, ...);
   *
   * Arguments will be checked against the types supplied at declaration, and
   * some attempt to convert values (e.g. boolean true/false to integer 0/1)
   * will be made. Otherwise, if types do not match, or conversion fails,
   * an exception will be thrown.
   */
  /* nsISupports declare (); */
  NS_SCRIPTABLE NS_IMETHOD Declare(nsISupports **_retval NS_OUTPARAM) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIForeignLibrary, NS_IFOREIGNLIBRARY_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIFOREIGNLIBRARY \
  NS_SCRIPTABLE NS_IMETHOD Open(nsILocalFile *aFile); \
  NS_SCRIPTABLE NS_IMETHOD Close(void); \
  NS_SCRIPTABLE NS_IMETHOD Declare(nsISupports **_retval NS_OUTPARAM); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIFOREIGNLIBRARY(_to) \
  NS_SCRIPTABLE NS_IMETHOD Open(nsILocalFile *aFile) { return _to Open(aFile); } \
  NS_SCRIPTABLE NS_IMETHOD Close(void) { return _to Close(); } \
  NS_SCRIPTABLE NS_IMETHOD Declare(nsISupports **_retval NS_OUTPARAM) { return _to Declare(_retval); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIFOREIGNLIBRARY(_to) \
  NS_SCRIPTABLE NS_IMETHOD Open(nsILocalFile *aFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->Open(aFile); } \
  NS_SCRIPTABLE NS_IMETHOD Close(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Close(); } \
  NS_SCRIPTABLE NS_IMETHOD Declare(nsISupports **_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->Declare(_retval); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsForeignLibrary : public nsIForeignLibrary
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIFOREIGNLIBRARY

  nsForeignLibrary();

private:
  ~nsForeignLibrary();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsForeignLibrary, nsIForeignLibrary)

nsForeignLibrary::nsForeignLibrary()
{
  /* member initializers and constructor code */
}

nsForeignLibrary::~nsForeignLibrary()
{
  /* destructor code */
}

/* void open (in nsILocalFile aFile); */
NS_IMETHODIMP nsForeignLibrary::Open(nsILocalFile *aFile)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void close (); */
NS_IMETHODIMP nsForeignLibrary::Close()
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* nsISupports declare (); */
NS_IMETHODIMP nsForeignLibrary::Declare(nsISupports **_retval NS_OUTPARAM)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


#endif /* __gen_nsIForeignLibrary_h__ */
