LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-23-2011, 08:24 AM   #1
shankar.489
Member
 
Registered: Jan 2011
Posts: 53

Rep: Reputation: 0
Question Need help in using swig tool


hi Folks,

iam very new to swig tool please dont mind if my doubt is obsolete

while loading the generated lib file to tcl module i got following as below

i know it is searching for "Tcl_DecrRefCount()" method please tell me the library name where above method is defined..!

or

if anything bad in my program please tell me that

thanks for your time on this


[root@localhost swig]# tclsh
% load ./example.so example
couldn't load file "./example.so": ./example.so: undefined symbol: Tcl_DecrRefCount


FYI
i have copied source from the internet please see the same attached code below


/* File : example.c */


#include <time.h>
double My_variable = 3.0;

int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}

int my_mod(int x, int y) {
return (x%y);
}

char *get_time()
{
time_t ltime;
time(&ltime);
return ctime(&ltime);
}



Interface file
/* example.i */
%module example
%{
/* Put header files here or function declarations like below */
extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
%}

extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();




unix % swig -tcl example.i
unix % gcc -fpic -c example.c example_wrap.c \
-I/usr/local/include
unix % gcc -shared example.o example_wrap.o -o example.so
unix % tclsh
% load ./example.so example
% puts $My_variable
3.0
% fact 5
120
% my_mod 7 3
1
% get_time
Sun Feb 11 23:01:07 1996

%

please try to spend some time on this.

regards
~shankar
 
Old 02-23-2011, 09:35 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,925

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by shankar.489 View Post
hi Folks,
iam very new to swig tool please dont mind if my doubt is obsolete while loading the generated lib file to tcl module i got following as below i know it is searching for "Tcl_DecrRefCount()" method please tell me the library name where above method is defined..!

or

if anything bad in my program please tell me that
thanks for your time on this

please try to spend some time on this.
If you tried to look this up on the Swig.org site, in their documentation, you would have found the answer. You need to include tcl.h
Code:
#include <tcl.h>
which has the missing function(s).
 
Old 02-24-2011, 12:24 AM   #3
shankar.489
Member
 
Registered: Jan 2011
Posts: 53

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TB0ne View Post
If you tried to look this up on the Swig.org site, in their documentation, you would have found the answer. You need to include tcl.h
Code:
#include <tcl.h>
which has the missing function(s).

example_wrap.c has tcl.h included already
 
Old 02-24-2011, 07:20 AM   #4
shankar.489
Member
 
Registered: Jan 2011
Posts: 53

Original Poster
Rep: Reputation: 0
Hi folks,

update reg. this issue

#nm example.so given Tcl_DecrRefCount() as undifined(U)

i guess this is something due to library missing, if so may i know that lib name? so that i can search in internet

thankyou
 
Old 02-24-2011, 11:34 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,925

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by shankar.489 View Post
Hi folks,

update reg. this issue
#nm example.so given Tcl_DecrRefCount() as undifined(U)
i guess this is something due to library missing, if so may i know that lib name? so that i can search in internet
thankyou
The same one mentioned before, tcl.h. Again, the swig.org website has this listed, along with the documentation, as I mentioned in my other post.

You say that tcl.h is included...but if you read the code you posted here, it IS NOT included. You've been given the solution, whether you choose to do anything with it or not, is up to you.
 
1 members found this post helpful.
Old 02-25-2011, 06:58 AM   #6
shankar.489
Member
 
Registered: Jan 2011
Posts: 53

Original Poster
Rep: Reputation: 0
iam sorry folks i really used another tcl.h(part of developer lib)
"tcl-devel-8.4.7-4.el4.i386.rpm" after using this rpm package it solved my problem

thanks for your time and sorry for my mistake..!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
swig 13.3.39, ubuntu 8.10, problem with importing C program to python plugo Linux - Software 1 08-09-2009 10:39 PM
perl mapi/swig dynaloader problem unkie888 Linux - Software 1 01-16-2008 06:56 PM
query regarding installing swig on Red hat Linux9 shweta12 Linux - Software 4 04-28-2005 12:44 AM
Swig sailu_mvn Programming 1 03-24-2005 09:20 AM
swig not found on configure migraineboy Linux - Newbie 1 07-28-2003 07:48 PM


All times are GMT -5. The time now is 02:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration