![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| file access log | jorgelopez100 | UNIX for Dummies Questions & Answers | 2 | 07-18-2008 12:09 PM |
| [C++] File I/O (Reading from a Random-Access File) | VersEtreOuNe | High Level Programming | 0 | 02-12-2008 04:34 PM |
| HOw I can Know who Access my file!! | geoquest | UNIX for Dummies Questions & Answers | 3 | 06-19-2002 06:10 PM |
| access file for sendmail | liyas | UNIX for Dummies Questions & Answers | 3 | 10-11-2001 10:10 PM |
| Need help to access/mount so to access folder/files on a Remote System using Linux OS | S.Vishwanath | UNIX for Dummies Questions & Answers | 2 | 07-30-2001 08:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
access .so file in C and C++
Hi All,
I created a simple .so file in C program on Linux and accessed it from another C program; I was successful but when I tried to access the same .so file from C++ program it gave me error " undefined reference". Now in new project I created another .so file in C++ program and accessed it from another CPP program; I was successful but when I tried to access same .so file from C program it gave me error "undefined reference " What am I supposed to do If I want to access a C program .so file from CPP program or vice versa. Any hints ![]() Thanks in advance.. ![]() |
|
||||
|
You should add extern to header file.
Code:
#if defined(__cplusplus)
extern "C"
{
#endif
//ptototype declare
char *yourfunction(void);
#if defined(__cplusplus)
}
#endif
please compare with results of below command with and without above description. Code:
readelf -sD libYourlib.so | grep "FUNC *GLOBAL" |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|