?
Solved

Call function from external library in linux

Posted on 2004-09-25
6
Medium Priority
?
171 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
5 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
Six Sigma Control Plans
Suggested Courses

589 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