Solved

Call function from external library in linux

Posted on 2004-09-25
6
159 Views
Last Modified: 2010-03-05

Hi guys,

 I am curious is it posible and how to call a function(s) from some library in linux? For example I have to get some data from a text file, mangling it and call a function to handle this data and put it in file! Any ideas will apprecate.
0
Comment
Question by:a9xus
  • 2
  • 2
6 Comments
 
LVL 13

Expert Comment

by:gripe
ID: 12154665
I'm not sure exactly what you mean by 'call a function(s) from some library in linux'. A library for what language?

For instance, Perl has an extensive library of modules that can do 'pretty much anything'. Are you talking about using Perl modules?

On the other hand, Perl also has a feature called 'XS' which allows you to embed C code in modules. This is often used to glue in C libraries.

Beyond these questions, could you define in simple terms what you're trying to accomplish? It's likely that you can do it in pure perl or use an existing module to do what you want.

More clarification please.

0
 

Author Comment

by:a9xus
ID: 12163501
I mean is there a module that allow me to execute functions from ... for example libbz2.so library?  I have seen some example with dynaloader but it's not useful for me! I hope this clarify my problem.
0
 
LVL 13

Expert Comment

by:gripe
ID: 12165704
Yes, there is a module to do this. the 'Compress::BZip2' module is an interface to Bzip2 library. You can get it at:

http://search.cpan.org/~kcarnut/Compress-Bzip2-1.02/Bzip2.pm (CPAN)

Hope this helps.
0
 

Author Comment

by:a9xus
ID: 12174943
This with the libbz2.so library was just an example.
The point was to make posible using of functions from our compiled libraries without embeding of C code into Perl module(s). I am sorry if I havent describe my problem more clearly!


   So I think the solution for my problem will be:
   http://search.cpan.org/~jtobey/C-DynaLib-0.55/DynaLib.pm

   NAME
   C::DynaLib - Perl interface to C compiled code.

   DESCRIPTION
   This module allows Perl programs to call C functions in dynamic libraries. It is useful
   for testing library functions, writing simple programs without the bother of XS, and
   generating C function pointers that call Perl code....



If you have other solution please let me know! Thanks for your answares grip
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12572590
PAQed with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to extract data from a table into a fixed length file 10 60
perl search and replace 6 171
Parse csv file and generate graphs in HTML in bash 8 235
Awk Question 2 129
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question