473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SWIG: name 'new_doubleArray' is not defined

Hello,

I am trying to use SWIG (1.3) to wrap some C code in Python (2.3.5)
under Linux, but obviously I am missing something with arrays.

This is my example.c file:

double sum_array(double x[], int size) {
int i;
double sum = 0.0;
for (i=0; i<size; i++) {
sum += x[i];
}
return sum;
}

This is example.i:

%module example
%include "carrays.i"
%array_functions(double, doubleArray);
%{
extern double sum_array(double x[], int size);
%}
extern double sum_array(double x[], int size);

These three command seem to work fine:

swig -python example.i
gcc -fPIC -c example.c example_wrap.c -I/usr/include/python2.3
ld -shared example.o example_wrap.o -o _example.so

In python, I can import the module:
import example
But this fails: a = new_doubleArray(10)

Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'new_doubleArray' is not defined

What am I doing wrong ?

Thanks for your help.

alex

May 17 '06 #1
0 1090

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: wabr7030 | last post by:
I have two xml file 1) xml source: <Indici> <F1>xxx</F1> <F2>yyy</F2> </Indici> 2) File colsDef.xml:
3
by: Wootaek Choi | last post by:
Hi, everybody.. I try to make common debug function that call in every js files used in a HTML.. but if same debug function name is defined in.... more than two javascrpt files, it would...
6
by: Xerxes | last post by:
Hi, how can I check if an input field in a form is defined? I create the field dynamically, so it could or could not be in the form. TIA.
1
by: Georgios Zakitraxis | last post by:
Hi, i have frames. I want to retrieve from a page in frame 1 the pagename of the page in frame 2 That should be possible with javascript, but I don't know how to. Suggestions, Hints, did...
4
by: Dmitry | last post by:
Hello, Sometimes on js code execution Mozilla 1.5 prints in JS concole the following error: "Error: fn is not defined" where "fn" is the function name surely defined _before_ the line that...
4
by: IMS.Rushikesh | last post by:
Hi All, I am trying to execute below code but it gives me an COMException ///// Code Start //// public string GetName(Excel.Range range) { try { if (range.Name != null)
2
by: Szabolcs Nagy | last post by:
the unicodedata manual sais: " name( unichr) Returns the name assigned to the Unicode character unichr as a string. If no name is defined, default is returned, or, if not given, ValueError is...
5
by: NetKev | last post by:
I added a function 'warn_Admin' and defined it just before another function 'process_log'. 'process_log' calls this warn_Admin' function. However, when it gets called i get the following error...
8
by: Dave G | last post by:
I know this is an old favourite but I can't find a simple answer to a simple question. I'm trying to run this: shell("c:\program files\pkware\pkzipc\pkzipc.exe -ext " & myPath & myZIPFile & "...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.