473,387 Members | 1,492 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,387 software developers and data experts.

defining extern variables in pyrex

Hi All,

I've inherited a c library and is the process of wrapping it using
Pyrex. The library code is a state machine and remembers previous values
in order to determine new values on, for example, a decode() call. These
"state-full" variables were all implemented using 'extern' in the c
code.

My wrapper works fine if I have only one instance of my new type
myclass. However, when I create more than one instance of myclass it
seems that the different instances each share the same extern variables.
And of course when one method call on a instance manipulates the
internal state machine it invalidates the other instance's state. I
guess this makes sense...

So, how do I define variables in the pyrex wrapper that is visible as
extern c values but are private to a instance ? Take a look at the
example, both val2 and val1 are defined as extern in some .h or .c files
in the library, val2 is visible but not private to myclass, val1 is
private to myclass but when I import myclasslib I get undefined symbol
errors like these:

ImportError: ./codex/efr/src/libgsmefr.so: undefined symbol: past_gain

example:
cdef short val2
cdef class myclass:
cdef short val1
I reckon that if I can define all the state-full vars in the same scope
as val1 and convince Pyrex (and the linker, I guess) that these are the
elusive externs I wouldn't need to go through the pain of passing these
state-full vars down each method call,

Do I have any hope of doing it this way ?

regards
Thys
Jul 18 '05 #1
0 978

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

Similar topics

4
by: John Ratliff | last post by:
I have a few global variables in my app. They are defined in the main application class file and declared (extern) in a header which can be included by anyone who would want to use these variables....
18
by: tweak | last post by:
What's the best way to use extern when using multiplefiles that is easiest to maintain? Is it best to declare: extern int a; in a header file and include the header file in all files except...
5
by: siliconwafer | last post by:
Hi all, I wanted to know that is use of extern keyword mandatory in case of global variables and functions used in other source files? i.e consider a following piece of code from MSDN explaining...
17
by: Tapeesh | last post by:
I would like to know what is the expected behaviour of C compilers when an extern decleration is intialized. When the following code is compiled using gcc //File extern.c int arr ; int a ;
3
by: Ami | last post by:
Hi All, I have a class and i want to share the instance of it, to many different units. To do this, I have declared the class type object in common header file, which is included in required...
27
by: Julien Fiore | last post by:
Do you wand to install Pyrex on Windows ? Here is a step-by-step guide explaining: A) how to install Pyrex on Windows XP. B) how to compile a Pyrex module. Julien Fiore, U. of Geneva
11
by: Jim Lewis | last post by:
Has anyone found a good link on exactly how to speed up code using pyrex? I found various info but the focus is usually not on code speedup.
2
by: Shraddha | last post by:
When I read about volatile keyword....while explaning there was an declaration like... extern const a; But as a rule const shoule be initialised where it is defined...but we do ot initialise...
11
by: whirlwindkevin | last post by:
I saw a program source code in which a variable is defined in a header file and that header file is included in 2 different C files.When i compile and link the files no error is being thrown.How is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.