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

  • SEARCH
  • Home
  • 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 6994683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:55:24+00:00 2026-05-27T19:55:24+00:00

I have requirement where the component is responsible for receiving a message and process

  • 0

I have requirement where the component is responsible for receiving a message and
process the message. There should be a generic message interface such as uint8 array (it is a binary message) and a generic framework, reads from an external configuration file, a list of handlers. The handlers should implement a generic interface such as :-

uint8[] process(uint8[] message);

Each handler should process the message and return the processed message to the framework, so that framework can hand the processed message to the next handler and so on.
The beauty of this approach is that it would allow adding new capabilities, hopefully at runtime, by adding a new handler in the configuration file. The generic framework should initialize the new handler, put it in its respective position of handlers and pass the message through all the handlers.

I have implemented this approach many times in Java, but I am struggling to implement it in C and C++. For example in C, I was thinking perhaps register each handler’s process function via a function pointer to the framework, so that framework can pass message to each of the handler. But I dont know how to inititialize the handlers based on config file. The config file will contain a “String” name of the handler. How does main method map that string name to the handler file?

Any pointers to code where such a pattern exists would be greatly helpful.

  • 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-05-27T19:55:24+00:00Added an answer on May 27, 2026 at 7:55 pm

    Well if your config file says this:

    handler1.so
    handler2.so
    handler3.so
    

    and you’re on a Linux platform, you can do this:

    void *lib = dlopen(name, RTLD_NOW);
    typedef uint8* (handler_t)(uint8*);
    handler_t *func = (handler_t*)dlsym("handler");
    

    for each name in the config file. This dynamically loads a shared library each of which contains a handler function (named “handler”).

    For other OS, similar facilities exist (LoadLibrary on Windows for a *.dll for example).

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

Sidebar

Related Questions

In our project we have requirement that, after receiving sms message from third party
I have a requirement to be able to provide a flex component in English
I have a ServiceInstall component in a WiX installer where I have a requirement
There are several third-pary controls (such as the Raize Components ) which have a
I have a seam component where I put a message using standard seam annotation:
I have a requirement to create a component which can be used stand-alone or
I have a specific requirement that all children of a particular JComponent have double
I have requirement of specifying web part connections in onet.xml. So when site is
I have requirement like, suppose I have a 'property' table which has 'ListingKey' field
We have a requirement in project to store all the revisions(Change History) for the

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.