Solved

Call function from external library in linux

Posted on 2004-09-25
6
155 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now