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

How to use library (.so) inside daemon

44
Hi,
I am a C++ programer but new on linux,
I wanted to know that what setting are requires to use library or DLL ( .so ) inside daemon.
I am able to use library in normal programs by setting LD_LIBRARY_PATH ,
but in case of daemon it is not working, error is "could not locate library".
Is there any way to set library path globaly so that my daemon will get and load library.

Thanks in advance,
Abhinay.
Jul 7 '08 #1
4 1987
arnaudk
424 256MB
The daemon is probably running in a different environment/shell. I suspect you'd have to set the LD_LIBRARY_PATH environment variable in some configuration file so that it's set every time a new shell session is started. Exactly which configuration file would depend on your linux distribution.

To see what I mean, try to set the variable in you current shell, then start a new shell by typing bash or csh, and you will see the variable is no longer defined.
Jul 8 '08 #2
gpraghuram
1,275 Expert 1GB
How are u starting the daemon?
If u are starting it from a shell script then set the LD_LIBRARY_PATH and the start it.


raghu
Jul 8 '08 #3
Abhinay
44
I am using centOS5 which is Redhat distribution and running mydaemond as service using command

service mydaemond start

I though my daemon fork new child, create new session and try to use library at new session at that time it is unable to find LD_LIBRARY_PATH as it is empty.
As documented DLL is loaded in memory before user program start, if i set LD_LIBRARY_PATH in session from which i m going to run my daemon then what colud be the problem.

Sorry to say but i am unaware of configuration file, can u plz tell me where it is located and how can daemon program read it every time when it start new session.

your suggestions will help me great.

Thanks
Abhinay
Jul 8 '08 #4
ashitpro
542 Expert 512MB
If your daemon is precisely written or compiled by you..then add -l<library name>
while compilation and use the library functions inside the code...
Jul 8 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Michael Ransburg | last post by:
Hi! I have implemented a daemon in C++. It runs all the time, between reboots. Is there a way for other C++ classes to get a reference to the instance of this daemon class in order to call its...
1
by: Stefan Neumann | last post by:
I have written a daemon which should run endlessly. The structure looks like this: - start-stop-daemon forks my python program then: if __name__=="__main__": try: main()
3
by: cgiatras | last post by:
I wanted to know if there was a C library out there to parse e-mails / attachments? what I am trying to do is an e-mail is sent to email@domain.com and that will be sent to this c program. It...
3
by: paul | last post by:
I am writing a daemon process that reads data from the serial port / dev/ttyS0. I am using pyserial & the method for setting up a daemon described in "Chris' Python Page"...
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...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.