Convert Program to Shared Library

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Andy202
    New Member
    • Jun 2008
    • 4

    #1

    Convert Program to Shared Library

    I have a program that sends and receives data via a TCP/IP socket, but I would like to convert this application to a Shared Library so that other programs can use this library to send() and receive() data.

    This is on a Unix platform using a gcc compiler.

    Forgetting about the send option for the present, I have the typically:-

    Code:
    // The client program for the application.
    #include "initComms.h"
    
    int main (int argc, char **argv)
    {
       // This is the main driver program for the Client.
    
       static DataStruct     dData;
       InitComms();
    
       printf("******** Into Client Main Loop    ********\n");
       while(true)
       {
    	ACE_TRY
    	dData = getData();
    	usleep(2000);
       }
       return 0;
    }
    So my question is what type of Shared Libray would I convert to (Static or Dynamic) and how would you make the getData() available to the calling program.

    Many thanks,

    Andy.
Working...