Solved

Call function from external library in linux

Posted on 2004-09-25
6
164 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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

734 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