Making python module using Borland C++ 5

Rami Saarinen rs55862 at
Tue Apr 8 12:15:14 CEST 2003

I am trying to build a simple module for python (2.1.1) using the 
Borland C++ Builder 5. I have managed to go as far as:

* used the coff2omf program to convert the python21.lib to omf format 
(guess how log it took to get past this..)

* the module is a crude and simple glue (for testing purposes) between 
python and a rule-engine (CLIPS) and looks like this:

PyMethodDef clipsMethods[] = {
   {"run",      pyclips_run,         METH_VARARGS},
   {"getMove",  pyclips_getMove,     METH_VARARGS},
   {"reset",    pyclips_reset,       METH_VARARGS},
   {NULL,       NULL,              NULL}

void _declspec(dllexport) initpyclips(void) {
   (void) Py_InitModule("pyclips", clipsMethods);

(th-ng.clp is a rule-based version of tower-of-hanoi solver).

Everything goes fine (after I removed the _DEBUG flag) and the dll 
builds without errors. However, when I actually try to run the python 
code that uses the module I get the following error message:

File "", line 1, in ?
   import pyclips
ImportError: dynamic module does not define init function (initpyclips)

Any ideas? Or am I totally lost and in error here?

I have been able to build and use the module in Linux without any 
trouble at all. I also managed to make the module in Windows using VC++ 
(that required a bit of manual helping) and it worked fine. However, I 
may be forced to get it done using Borland so ...

Well, I have been learning a lot about making static and dynamic 
libraries on Windows (as well as using these graphical thingies), a 
topic I had no idea about few weeks ago.. 8)

Thanks in advance.

Rami Saarinen

Please do remove the obvious bit from the email
if you wish to reply to me personally.

More information about the Python-list mailing list