Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:33:13+00:00 2026-06-05T15:33:13+00:00

I have an script interpreter that is spawn by a deamon and has to

  • 0

I have an script interpreter that is spawn by a deamon and has to be up all the time.
In other words, as soon as it goes down (crash, segfault, normal termination, whatever), the daemon spawns that again.

This interpreter opens a library dynamically using dlopen (lib1).
This library opens a lot of other libraries (lib2, lib3, …). Some of them make reference to the first library. So I’m using the RTLD_GLOBAL and RTLD_NOW flags for the dlopen call.

Up to this point, everything works well.

Problems arises when the interpreter is killed or crash and get spawned again.
I use dlopen once again, no problem… I can call lib1‘s functions normally.
In lib1‘s code, I make a call to a function from lib2.
The program just stops there.

It looks like it hasn’t crashed (no segfault or something).
There is a debug call right before the call and other in the first line of the function.
The first gets executed. The second one doesn’t.

One last detail: lib1 is actually a C++ library that returns an object instance.
I’m omitting destroyer method from lib1 and all the headers from all modules.
If anyone judge that important, I can give more information.

Does anyone have any idea on what may be happening?

To ilustrate scenario, consider the “pseudo” code:

Interpreter:

Lib1_obj *instance;

void interpreter_start() {
  // dlopen lib1
  // get lib1_creator symbol.
  instance = lib1_creator();
}

void interpreter_on_event_X() {
  int x = instance->method1();
  printf("x = %d\n", x);
}

Lib1:

class Lib1_obj {
public:
  int method1() {
    printf("Check point 1.\n");
    return lib2_do_something();
  }
}

Lib1_obj * creator() {
  return new Lib1_obj();
}

Lib2:

lib2_do_something() {
  printf("Check point 2.\n");
  return 1;
}

I suspect the problem has something to do with the fact I can’t call dlclose when the process gets killed. Is it possible that it messes up the dlopen mechanism?

Thanks very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:33:14+00:00Added an answer on June 5, 2026 at 3:33 pm

    There was a lib that wasn’t compiled with the -fPIC option.
    Doing so solved the problem.

    Thanks user315052 for the help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I often have to edit script files, the interpreter for which treats files that
We have an existing java-based heavyweight project that needed an interactive script interpreter. After
We have a system that only has one interpreter. Many user scripts come through
I have some script in my default page that redirects users to language specific
I have a script that checks something on my PC every 5 minutes and
I have a script that connects to SQL Server 2005 default instance. But I'm
I have a script that will convert a text file into a resource file,
I have a script that generates DDL scripts to define materialized views for a
I currently have a script being executed by a program that comes with its
I have a Python script that I'd like to compile into a Windows executable.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.