Solved

Call function from external library in linux

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending email via Perl on Windows 3 138
collecting information 2 140
Perl Write to Specific line in a file 15 76
Regex rule to match two different url 5 60
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…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

896 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

12 Experts available now in Live!

Get 1:1 Help Now