Sponsored Content
Full Discussion: C++ library in C
Top Forums Programming C++ library in C Post 302271714 by willing007 on Saturday 27th of December 2008 10:51:05 AM
Old 12-27-2008
Quote:
Originally Posted by smanu
Hi,

I have a bunch of C++ files whose functionality needs to be included in another piece of C code. Is it possible to create a C++ library and link it with C code?
you call compile as a dll, call it by dlopen dlsym
 

7 More Discussions You Might Find Interesting

1. Programming

C library

Does anybody know are there free C library that implements most features of C++ standard library? e.g. I've used Berkeley in-memory db as maps (hash) but this isn't sufficient (7 Replies)
Discussion started by: Hitori
7 Replies

2. UNIX for Dummies Questions & Answers

GD library?

I've just been told that I need to install the GD library for PHP on my server, but I've got no idea how to do that or even:eek: where I can find it so that I can download and install it. Is it easy to do and how would I go about doing it?:confused: By the way I believe the server is running... (4 Replies)
Discussion started by: thehaapyappy
4 Replies

3. Shell Programming and Scripting

How to change a Makefile from building static library to shared library?

Hi: I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library) Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies

4. Linux

Could static library include static library?

I have some static library(libxxx.a libyyy.a). And I want to generate my library(libzzz.a), libzzz.a will use libxxx.a and libyyy.a I wan't my application only use libzzz.a, (means libzzz.a had include libxxx.a, libyyy.a), how can I do that? Thank you. example: I have zzz.c. I do ... (4 Replies)
Discussion started by: freemagic
4 Replies

5. Linux

./configure problem for libsf library due to apparently missing libdb library.

Hello, ./configure script fails to configure libsf. Please check the following last few lines of configure script error. checking for db1/db.h... no checking for db.h... yes checking for dbopen in -ldb1... no configure: error: No libdb? No libsf. But find command shows the following; ... (4 Replies)
Discussion started by: vectrum
4 Replies

6. AIX

Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message. add shr4.o shared members from /usr/lib/libiconv.a to /opt/freeware/lib/libiconv.a add shr.o shared members from /usr/lib/libiconv.a to ... (5 Replies)
Discussion started by: kneemoe
5 Replies

7. Programming

C++ linking library to a library

Hi All, My application main engine will use a shared library where we do many operation. We are trying to implement the linear algebra operation on the shared library for that I need to link my shared library to the lapack library in /usr/lib. Below is my make file. Can you please let me... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies
DLSYM(3)						   BSD Library Functions Manual 						  DLSYM(3)

NAME
dlsym -- get address of a symbol SYNOPSIS
#include <dlfcn.h> void* dlsym(void* handle, const char* symbol); DESCRIPTION
dlsym() returns the address of the code or data location specified by the null-terminated character string symbol. Which libraries and bun- dles are searched depends on the handle parameter. If dlsym() is called with a handle, returned by dlopen() then only that image and any libraries it depends on are searched for symbol. If dlsym() is called with the special handle RTLD_DEFAULT, then all mach-o images in the process (except those loaded with dlopen(xxx, RTLD_LOCAL)) are searched in the order they were loaded. This can be a costly search and should be avoided. If dlsym() is called with the special handle RTLD_NEXT, then dyld searches for the symbol in the dylibs the calling image linked against when built. It is usually used when you intentionally have multiply defined symbol across images and want to find the "next" definition. It searches other images for the definition that the caller would be using if it did not have a definition. The exact search algorithm depends on whether the caller's image was linked -flat_namespace or -twolevel_namespace. For flat linked images, the search starts in the load ordered list of all images, in the image right after the caller's image. For two-level images, the search simulates how the static linker would have searched for the symbol when linking the caller's image. If dlsym() is called with the special handle RTLD_SELF, then the search for the symbol starts with the image that called dlsym(). If it is not found, the search continues as if RTLD_NEXT was used. If dlsym() is called with the special handle RTLD_MAIN_ONLY, then it only searches for symbol in the main executable. RETURN VALUES
The dlsym() function returns a null pointer if the symbol cannot be found, and sets an error condition which may be queried with dlerror(). NOTES
The symbol name passed to dlsym() is the name used in C source code. For example to find the address of function foo(), you would pass "foo" as the symbol name. This is unlike the older dyld APIs which required a leading underscore. If you looking up a C++ symbol, you need to use the mangled C++ symbol name. SEE ALSO
dlopen(3) dlerror(3) dyld(3) ld(1) cc(1) August 28, 2008
All times are GMT -4. The time now is 12:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy