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 7168331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:45:32+00:00 2026-05-28T14:45:32+00:00

I am trying to modify iperf to support another protocol (UDT). The UDT API

  • 0

I am trying to modify iperf to support another protocol (UDT). The UDT API is written such that it mirrors the standard BSD calls:

  socket(...);
  bind(...);
  listen(...);

What I need to do then, is conditionally link with the UDT library so that these calls in iperf will use the UDT code instead of the socket interface to the TCP stack. Can this be done? I could always just load the library and have another conditional path using the UDT:: namespace but there would 1) be a lot of duplication from the TCP path and 2) be a lot of changes where maybe there need be none. Please let me know if I’m not being clear, any suggestions of how to achieve this dynamic linking is appreciated.

Edit:

Using the dlopen() family mentioned below, I could have the following program flow:

Parse cmd line params -> if UDT is requested, load library libudt ->
get and store handles to all the UDT BSD functions (bind, listen, etc)

At this point I have function pointers stored with all my UDT functions. Let’s say I’m storing them all in a struct called udt_calls. Now, I have a problem with the existing code which just makes calls like:

          bind(...)

rather than:

         udt_calls->bind(...)

Is there a clean way I can globally override any BSD call throughout the program with my now loaded function pointers in my udt_calls struct?

  • 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-28T14:45:33+00:00Added an answer on May 28, 2026 at 2:45 pm

    Yes this can be done. You need to use dynamic library loading. In Windows this is done using LoadLibrary. In Linux or Unix it is done using dlopen and friends.

    You’ll want to read the documentation and look at samples for those functions. A quick summary is that you create a bunch of function pointers (often done in a struct, and on Windows there are some tricks to make them load into a C++ virtual function class). Then you use the dynamic load functions to open a library and then assign your function pointers to point to the functions inside the library.

    Then, you make your function calls using the function pointers (or C++ virtual functions).

    Edit: It looks like there are ways to use C++ virtual base classes in Unix as well.

    Edit: I believe that most systems make the operating system libraries use “weak” symbols. That means that you can define your own global symbols of the same name and override the OS library version. Try declaring global function pointers in your own program to provide global versions of bind and listen.

    Another option may be to declare your pointers in a struct and then use preprocessor defines like:

    #define bind udt_calls->bind
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to modify a script that someone else has written and I wanted
Hi I'm trying to modify a web page so that it loads faster. Since
I've been trying to modify the AuditTrail code so that it does not copy
I'm trying to modify some exports. I understand that this code doesn't work because
i've been trying to modify the program so that it could accept more than
I am trying to modify a registry key that I have been told controls
I'm trying to modify the following rewrite conditions so that only strings that begin
I am currently trying to modify a Javascript function that slides in a <div>.
I'm trying to modify a C# WinForms application that uses multiple forms. At startup,
I'm trying to modify my test so that any database work is rolled back

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.