[Numpy-discussion] Another CXX question

pfenn at mmm.com pfenn at mmm.com
Thu Jan 11 17:29:22 EST 2001


This is probably a stupid coding error, but the following code generates
the error:

C:\Program Files\Microsoft Visual
Studio\MyProjects\Xrawdatafile\Xrawdatafile.cpp(32) : error C2065:
'FromAPI' : undeclared identifier

I've marked the line in the listing that causes the error.  It occurs in
the function that creates a new datafile_type object to return to the
interpreter.   Right now the datafile_type object is very simple, and has
but one method that prints a hardcoded string.  I'm using CXX-4.?? with
Visual C++ 6.0 and SP3.  I'm going to download SP4 tonight and see if that
helps, but any hints would be appreciated.  I haven't been doing C++ for
very long, so I'm probably mising something obvious.

//****************************************************************************************************************
// Xrawdatafile.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include <CXX/CXX_Objects.h>
#include <CXX/CXX_Extensions.h>
#include "Xrawdatafile.h"
#include "datafile_type.h"

BOOL APIENTRY DllMain(HANDLE hModule, DWORD  ul_reason_for_call, LPVOID
lpReserved) {
     switch (ul_reason_for_call) {
          case DLL_PROCESS_ATTACH:
          case DLL_THREAD_ATTACH:
          case DLL_THREAD_DETACH:
          case DLL_PROCESS_DETACH:
               break;
    }
    return TRUE;
}

class datafile_module : Py::ExtensionModule<datafile_module> {
public:
     datafile_module() : Py::ExtensionModule<datafile_module>("datafile") {
          datafile_type::init();
          add_varargs_method("datafile",
&datafile_module::new_datafile,"datafile(filename)");
          initialize("interface to ThermoFinnigan XRaw data files.");
     }
     virtual ~datafile_module() {
     };
private:
     Py::Object new_datafile(const Py::Tuple& args) {
          return Py::asObject((new datafile_type()));   //  THIS LINE
CAUSES THE ERROR
     }
};


extern "C" __declspec(dllexport)  void initdatafile(void) {
     static datafile_module *dfm = new datafile_module;
}

//****************************************************************************************************************************





More information about the NumPy-Discussion mailing list