Staging
v0.8.1
Revision da746d7a0e9d8b573e639bdce25430a69d283c1a authored by Georg Brandl on 13 March 2010, 10:02:01 UTC, committed by Georg Brandl on 13 March 2010, 10:02:01 UTC
svn+ssh://svn.python.org/python/branches/py3k

................
  r77173 | benjamin.peterson | 2009-12-31 04:35:15 +0100 (Do, 31 Dez 2009) | 13 lines

  Merged revisions 77151-77152 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r77151 | georg.brandl | 2009-12-30 12:32:50 -0600 (Wed, 30 Dec 2009) | 1 line

    #7487: update Pygments version.
  ........
    r77152 | georg.brandl | 2009-12-30 12:36:09 -0600 (Wed, 30 Dec 2009) | 1 line

    #7602: improve "clean" and "checkout" targets now that all tools are in externals.
  ........
................
1 parent 87e62f0
Raw File
dynload_os2.c

/* Support for dynamic loading of extension modules */

#define  INCL_DOSERRORS
#define  INCL_DOSMODULEMGR
#include <os2.h>

#include "Python.h"
#include "importdl.h"


const struct filedescr _PyImport_DynLoadFiletab[] = {
	{".pyd", "rb", C_EXTENSION},
	{".dll", "rb", C_EXTENSION},
	{0, 0}
};

dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
				    const char *pathname, FILE *fp)
{
	dl_funcptr p;
	APIRET  rc;
	HMODULE hDLL;
	char failreason[256];
	char funcname[258];

	rc = DosLoadModule(failreason,
			   sizeof(failreason),
			   pathname,
			   &hDLL);

	if (rc != NO_ERROR) {
		char errBuf[256];
		PyOS_snprintf(errBuf, sizeof(errBuf),
			      "DLL load failed, rc = %d: %.200s",
			      rc, failreason);
		PyErr_SetString(PyExc_ImportError, errBuf);
		return NULL;
	}

	PyOS_snprintf(funcname, sizeof(funcname), "PyInit_%.200s", shortname);
	rc = DosQueryProcAddr(hDLL, 0L, funcname, &p);
	if (rc != NO_ERROR)
		p = NULL; /* Signify Failure to Acquire Entrypoint */
	return p;
}
back to top