Python extension or dll and calldll?
rjs
rjs at blue-cove.com
Tue Apr 16 16:24:41 EDT 2002
After reading through http://www.python.org/doc/ext/intro.html, and
not being a good C programmer (although I have access to MS VS 6), and
since I have not written either a Python extension or ddl before, and
anticipating having to spend some time learning, which is easier: turn
the ANSI C code into a dll and call it (which I do for another project
using ioport) or write a Pyhton extension? The code is a fairly
straight-forward neural network, the makefile and header are below.
I'm writing wxPython and would just like to do direct calls to the
functions. I have a server/socket based version of the NN I run on
Linux, but that would require socket(), and I would like a desktop app
(for MS for now...)
Suggestions/experiences appreciated...
Ray
# Makefile
CC = cc
SRCS = iRACE.c serverb.c
OBJS = iRACE.o serverb.o
INCLUDES= iRACE.h
LIBS = -lm
TARGET = server
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) -o $(TARGET) $(OBJS) $(LIBS)
clean:
rm -f $(OBJS) $(TARGET)
/* rbfnet.h - function prototypes */
/* Define some commonly used NETWORK receptive fields geometries */
#define HYPERDIAG (int)'A'
#define RECTANGULAR (int)'R'
#define LINEAR (int)'L'
#define SPLINE (int)'S'
#define CUSTOM (int)'C'
int allocate_rbfnet(int num_state,int *qnt_state,
int num_resp, int num_cell,
int memory, int rfield_shape, int collision_flag);
int train_rbfnet(int rbfnet_id, int *state, int *respns, int beta1,
int beta2);
int rbfnet_response(int rbfnet_id, int *state, int *respns);
int clear_rbfnet_weights(int rbfnet_id);
int deallocate_rbfnet(int rbfnet_id);
int rbfnet_memory_usage(int rbfnet_id);
int get_rbfnet(int rbfnet_id, int index, int *buffer, int count);
int put_rbfnet(int rbfnet_id, int index, int *buffer, int count);
int adjust_rbfnet(int rbfnet_id,int *state,int *drespns,int beta1);
int map_rbfnet_input(int rbfnet_id,int *state,int *weights[], int
*rfmags);
int set_rbfnet_rf_displacement(int rbfnet_id,int *buffer);
int set_rbfnet_rf_magnitude(int rbfnet_id,int *buffer);
int save_rbfnet(int rbfnet_id,char *filename);
More information about the Python-list
mailing list