473,324 Members | 2,456 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,324 software developers and data experts.

shared library accessing common data

Hi all,
Thanks for haveing this group. I am in search of a solution to
Q. Thought of geeting the same from experts.

I have c files to generate shared libraries (not relating to
linux,unix,windows) and would like to share data with other libraries.
For Eg:.

Fileone.c --------gives me Fileone.so input to this is a text file
Country.txt (set of integers)
Filetwo.c ---------gives me Filetwo.so input to this is a text file
Country.txt (set of integers)

Now both Fileone.so and Filetwo.so are reads Country.txt...... My
question "Is is a way by which i can avoid reading of Country.txt
second time?"

I used a common header.h file which had static int *bar. But this did
not work.

Thanks in advance
Lb

Aug 10 '06 #1
2 1643
leby said:
I have c files to generate shared libraries (not relating to
linux,unix,windows) and would like to share data with other libraries.
For Eg:.

Fileone.c --------gives me Fileone.so input to this is a text file
Country.txt (set of integers)
Filetwo.c ---------gives me Filetwo.so input to this is a text file
Country.txt (set of integers)
Since each of these appears to read a particular, named text file, they are
presumably nailed to an application and so are not of general usefulness.
So I have to wonder what they are doing in libraries.
Now both Fileone.so and Filetwo.so are reads Country.txt...... My
question "Is is a way by which i can avoid reading of Country.txt
second time?"
Delete one of the source files. If they do the same job, you only need one
of them.
I used a common header.h file which had static int *bar. But this did
not work.
Well, it wouldn't. That isn't the way to go. I suspect that what you really
want is one routine that can read and store - in memory - any file of the
appropriate format - and /that/ routine certainly belongs in your library -
and other routines to let you look at that memory and answer questions
about it. Those routines might well deserve a place in your library too.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Aug 10 '06 #2
leby wrote:

<snip>
I have c files to generate shared libraries (not relating to
linux,unix,windows) and would like to share data with other libraries.
For Eg:.

Fileone.c --------gives me Fileone.so input to this is a text file
Country.txt (set of integers)
Filetwo.c ---------gives me Filetwo.so input to this is a text file
Country.txt (set of integers)

Now both Fileone.so and Filetwo.so are reads Country.txt...... My
question "Is is a way by which i can avoid reading of Country.txt
second time?"

I used a common header.h file which had static int *bar. But this did
not work.
I'm not sure what you are doing. So I may be wrong in my suggestions.
Modify Fileone and Filetwo so they read from a data structure rather
than a file and invent another library to load the country.txt file.

country.h
------------

typedef void* Country_context;

/* loads the country.txt file, if necessary */
void load_country (void);

/* returns a pointer to the first position in the country data
structure */
Country_context open_country (void);

void close_country (Country_context context);

/* if successful returns non-zero, sets country to the current value
pointed to and advances the pointer to the country data structure */
int read_country (int* country, Country_context context);

and yes, I meant context not to be a pointer in that last call.
--
Nick Keighley

Aug 10 '06 #3

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

Similar topics

6
by: klh | last post by:
I have an old version of DB2 Connect (v 6) installed on a Sun Solaris (v 2.9)box. It has been installed for several years, and to me, it seems to work okay. However, an application that uses DB2...
0
by: Peter | last post by:
When I issue call sqlj.install_jar('file:///f:/jars/mail.jar','MAIL'); I get the messages SQL4301N Java or .NET interpreter startup or communication failed, reason
2
by: santa19992000 | last post by:
Confusing th eword with "library", "shared library" and how to use these things in real C project, is there any small example I can take a look. Thanks.
9
by: Invalidlastname | last post by:
Hi, We developed some assemblies which use EnterpriseServices queued components. In order to use EnterpriseServices, these assemblies need to be installed into GAC. I used the pre-build and...
6
by: Jon Davis | last post by:
I like the drag-and-drop accessibility of dragging a table to a Web Forms designer and seeing a SqlDataAdapter automatically created for me.. being able to create a DataSet from that is fun and...
8
by: Al | last post by:
I'd like to create Class Library in VB 2005, which has a property accessible by external programs. I decided to include 1 Class with 1 property in this project. I placed this code in Class:...
7
by: akennis | last post by:
First of all, sorry for duplicating this post. I put it up in the alt.comp.lang.learn.c-c++ mistakenly. I'm investigating a problem whereby exceptions thrown from functions in a Shared Library...
10
by: Oriane | last post by:
Hello, I have to share a object in RAM between several processes. I intend to design a special process to load this objet (an Autocad plan) in memory, and to take care of the read/write...
3
by: Bala | last post by:
Hello, I am trying to create a shared library on solaris. The inputs to this library is a source file and then 2 static libraries. I need to call code within the shared library in another...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.