Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

threads and inline
hey all,

I'm trying to build an application which has a threading component, and am
having a damn hard time making it work..

Here's my inline call:

use Inline (
'C++' => 'DATA',
LIBS => '-L. -L/homes/edp/tmp/ipworksssl-6.2/lib
-lipworksssl -lhttpwrap -lssl -lcrypto -lcrypt',
CC  => '/tmp/gcc/bin/g++',
CCFLAGS => '-pthread -static -static-libgcc',
'LDDLFLAGS' => '-pthread -shared -static-libgcc'
);

I've compiled g++ with --enable-threads, but still no luck, I get at
runtime:


Can't load

_Inline/lib/auto/aab_p_6230/aab_p_6230.so' for module aab_p_6230:
lib/libipworksssl.so.6: Undefined symbol "pthread_mutex_lock" at

/opt/tools/generic/dev/i686/FreeBSD/lib/perl5/5.8.8/i386-freebsd-64int/DynaL
oader.pm
line 232.


Any ideas? Has anybody built a Inline call that used something that had
thread support in it (not that I'm using the threads, I'm just trying to
wrap the package as simple as I can..

Ed


Report this thread to moderator Post Follow-up to this message
Old Post
Edward Peschko
05-05-08 12:55 AM


Re: threads and inline
----- Original Message -----
From: "Edward Peschko" <horos11@gmail.com>
.
.
> Can't load
>
> _Inline/lib/auto/aab_p_6230/aab_p_6230.so' for module aab_p_6230:
> lib/libipworksssl.so.6: Undefined symbol "pthread_mutex_lock" at
>

If you reckon that you won't actually need the genuine pthread_mutex_lock,
you could just code one up yourself and put it (eg) at the beginning of your
C/C++ code:

void pthread_mutex_lock() {}

I've had success resolving undefined symbols using hacks like that in the
past (though I've not actually tried it with Inline).

Other than that, I guess you'll have to find the library that defines the
symbol "pthread_mutex_lock" and specifically link that library in.

Cheers,
Rob


Report this thread to moderator Post Follow-up to this message
Old Post
Sisyphus
05-05-08 10:31 AM


Re: threads and inline
On May 5, 2008, at 3:17 AM, Sisyphus wrote:

>
> ----- Original Message ----- From: "Edward Peschko"
> <horos11@gmail.com>
> .
> . 
>
> If you reckon that you won't actually need the genuine
> pthread_mutex_lock, you could just code one up yourself and put it
> (eg) at the beginning of your C/C++ code:
>
> void pthread_mutex_lock() {}
>
> I've had success resolving undefined symbols using hacks like that
> in the past (though I've not actually tried it with Inline).
>
> Other than that, I guess you'll have to find the library that
> defines the symbol "pthread_mutex_lock" and specifically link that
> library in.

That library would be libpthread. The issue with defining a bogus
mutex lock is that eventually you'll hit that concurrent access that
corrupts your memory and causes very weird action at a distance
issues. I recommend linking with -lpthread and sparing yourself the
headache :) These days on linux the pthread library is frequently in /
lib/. You can inspect the symbols via "nm /lib/libpthread.so.<version>".

That being said, I would have expected the -pthread or -pthreads
option in gcc to take care of that for you. What version of gcc and OS
are you using?

For what it's worth, I wrote a simple CORBA client library that used
threads internally and created C wrappers for embedding it into perl.
It worked out fine, but I did have to link to the appropriate
threading library to get it working.


--
J.
Another hour, another mile, one more year
Your older self may whisper in your ear
The effort is illusion
But later hold you in their arms with the gratitude
Of a person who lived without regret.



Report this thread to moderator Post Follow-up to this message
Old Post
Jason Stelzer
05-06-08 01:42 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL INLINE module archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 11:12 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.