Programming :: Put Header Files For A Shared Library?

Feb 26, 2010

I have written a simple library and ended up with a .so file. I have a header file from writing the code that describes how to use the functions in the source code I have written. I think this .h files needs to be available to other programs that access this code.

I have seen lots of tutorials on how to copy the .so file to the relevant directories and make links with the version number. What I can't find is where to put the header file so that any programs I write to use my new library can access the header.

Hope this makes sense. For example, I might use <stdio.h> normally, I will need to access <mylibrary.h> once mylibrary.so is loaded (as far as I understand!)

It's weird, I've been using C compilers for embedded processors over ten years now and never given a second thought to how libraries and headers work behind the scenes!

View 6 Replies


ADVERTISEMENT

Programming :: SDL Static Library - Shared Library ?

Apr 7, 2009

I'm reading about shared, static, and dynamic libraries. What is SDL? Is it static, shared, or dynamic?

I always thought a library would be a lot of .h and .cpp files compiled separately into .o files and then if you compiled your own program you could use the -l parameter to link the library and it was all compiled together. Now I'm not so sure.

I don't even see any SDL .cpp files in my system anywhere. All I have are lots of SDL .h files in /usr/include/SDL and I don't really understand the code in them.

I'm making a wild guess here: SDL is a shared library. SDL itself is NOT compiled into my program, therefore SDL must be on any system my program tries to run on. When I compile and link SDL all it needs is the header files to know what SDL function and objects it can use. And then on every system it uses an already compiled SDL shared library thingy somewhere.

So... where is that part of SDL? All I can find are header files.

I'm thinking the advantage of shared libraries is that someone could say update SDL on their own system and take advantage of the new features without having to download new executables with the new version of SDL compiled into them for every program that uses SDL.

So if I'm making an editor and a game engine and they both use a lot of the same .cpp and .h files that I wrote and I'm tired of updating one and then the other and I need to turn them into a library, then a shared library might be kind of a silly solution. I could just make a static library. Right? Because it's not SDL. Nobody else is ever going to use this library.

View 6 Replies View Related

Programming :: Setting For Header File And Library?

May 8, 2010

I have 3 files: main.c, mylib.h, mylib.c Now I want to put mylib.h into : /usr/include/mydir/mylib.h And I create a static library: libmylib.a, and put into the folder: /usr/lib/mydir/libmylib.a Then I compile: $ gcc -o main main.c Then I got linking error

Code:
main.c:(.text+0x3e): undefined reference to `extract_v1'
main.c:(.text+0x7b): undefined reference to `modify_v1'
collect2: ld returned 1 exit status

So I try with -l options: $ gcc -o main main.c -lmylib I still got error

Code:
/usr/bin/ld: cannot find -lmylib
collect2: ld returned 1 exit status
Any idea about this?

Also, I want to ask about: how to create my own header and library to put into /usr/include/mylib/ and /usr/lib/mylib/, so when I use function in my program, the compiler will automatically link to library. It's like when you #include <stdio.h>, and you compile: $ gcc -o program program.c, you don't need to specify any linking folder or library.

View 4 Replies View Related

Programming :: Can't Load Shared Library (but It's Right There!)?

Feb 15, 2011

I have visited these boards a few times, but never posted. Here's my problem: I was given the source to a program and asked to get it running on a 64-bit Debian 2.6.26 machine. Currently it is working on 2 64-bit OpenSUSE machines.

The application uses TCL TK for a GUI and everything compiles just fine; however, on startup, the user must enter one of three possible modules to load; when attempting to load these modules (tcl 'load' function), I receive this error:

Code:
Error in startup script: couldn't load file "../Build/libMpf.so": libTransReaders.so: cannot open shared object file: No such file or directory
while executing
"load ../Build/libMpf.so Mpf"
("eval" body line 1)
invoked from within
"eval load ../Build/${px}${i}${sx} $i"

[Code]...

View 8 Replies View Related

Programming :: Default Library - Static Or Shared?

Aug 27, 2009

My code needs to link to some libraries. In my project file, I specify linker to link to abc library, for example. By default, does gcc link to libabc.a or libabc.so ? What if I really need to specify static or shared, how do I do that?

View 4 Replies View Related

General :: Link Shared Library Against Other Shared Library?

May 27, 2010

I think that the solution is very simple, but I cannot reach this solution. I'm trying to build an B.so that uses A.so.

A.so is compiled using C;
B.so is compiled using C++;

Inside "Aso.h" file I'had declared:

Code:

#ifdef __cplusplus
extern "C" {
#endif

[code]....

There's no error to compile that, this library seems to be compiled correctly, but using the "nm" command the Aso.so functions appear with "U" of undefined. Trying to build an executable using the Bso.so library, I got this error: /lib/../lib/libBso.so: undefined reference to `foo(int, int, int)' I think that to solve this problem it's only link the Aso.so with the .o files generated at the compilation phase of my Bso. Using the "ldd" command I'm able to see that Bso.so depends on Aso.so, so what am I missing?

View 2 Replies View Related

Debian Programming :: Packaging Shared Library With Python Wrapper

Apr 12, 2014

I have written a shared library and successfully used debhelper 9 to create a Debian package from source using a Makefile generated by cmake. I then went about writing a python wrapper to that library and wish to package that wrapper in with the library so I can have a single distributable rather than 2 separate ones.

All of my attempts so far have me placing my python source and a setup.py file in the same directory as the makefile at the time where I call debuild.

From here I have tried a couple different configurations to my debian/rules file as seen below:

Attempt 1:
# -*- makefile -*-
%:
dh $@ --with-python2 --buildsystem=python_distutils

This try seemed to package up the python stuff nicely but proceeded to ignore my makefile for the shared library and therefore ultimately failed.

Attempt 2:
# -*- makefile -*-
%:
dh $@ --with-python2

This try ran make, but completely ignored the python stuff. From some research I have gathered that the --buildsystem flag tells debuild to ignore any makefiles in the directory, which obviously causes a problem in my case.

Another attempt was to modify the build dependency to first run make and then call the python build process that file looked like this

Attempt 3:
# -*- makefile -*-

build:
dh $@
dh $@ --with-python2 --buildsystem=python_distutils
%:
dh $@ --with-python2 --buildsystem=python_distutils

This appears to somewhat work as both processes do build, but a few of the python files are still not getting installed.

Is this the way I should be going about doing this? I've noticed that most python wrappers tend to package themselves individually and then make that package dependent on the library it is attempting to wrap.

View 0 Replies View Related

Programming :: Integration Of Shared Library Package With Application Environment

Mar 18, 2010

I am currently having an application package which provides some applications.however API's for the same will be provided by third party.Currently i am using a dummy functions in my code.Now i have a release by the third party for the first Api version.They have given a set of .so libraries.How do i integrate this with my application?Also i need an idea in general to how to go ahead with programming in such a development scenario where in it is distribued?

View 3 Replies View Related

Programming :: Save / Load Data Segment Of Dynamically Loaded Shared Object Library?

Aug 25, 2010

Our application uses a dynamically loaded shared object library (codec library) to compress and decompress audio streams.

There happens to be several static and global variables in this shared object library. Hence it is not possible to process two interleaved unrelated media streams using this shared object codec library because each stream corrupts/changes the contents of these static/global variables.

Is there a way through which a context save (save contents of data segment of shared object) and a context load (load previously saved contents of data segment of shared object)operation can be performed on the shared object library. This way the context for each media stream can be saved and loaded before and after processing the "other" media stream respectively.

View 3 Replies View Related

Programming :: C Header Files And Object Files ?

Sep 18, 2010

When is it good to use separate translation units and object files and link them into the main C program, and when is it good to include the header files in the main C program? I don't understand if most people include header files or if most people just link in object files and use their contents in the main program. It's sort of a simple question, but it's confusing to me and that's why I need help with it. I sort of don't understand the difference, or if there's really no difference other than the way the final result is achieved, which way is better or preferred, etc...

For example:

Code:

or:

Code:

Simple explanation of the difference? or which one is preferred or better? I've read a little on the ELF format... so is there no difference in the end result? It's just a matter of preference or necessity, and where the information is to begin with?

View 9 Replies View Related

Programming :: Cannot Find Header Files To Use Kmalloc()

Jun 16, 2010

I want to use kmalloc() to allocate contiguous memory on ram. But I can not seem to find the required header file(s) like linux/slab.h. I suppose I do not have the required library and I certainly do not know what and where to look.

View 14 Replies View Related

Programming :: How To Attach New C Header Files And Libraries

Mar 10, 2010

I have been a predominant Windows user for a long time but shifted to Ubuntu recently. I was just trying out a few basic C functions when i realized that the "conio.h" header file isn't included in the libraries and therefore i was unable to use the "clrscr()" function.

I downloaded a tarball which contained the necessary library and header files including conio.h. Once extracted, i specified the location and included in the program as " #include "path to the header file" ".

I still didn't call the "clrscr()" function, and it compiled successfully. Next i edited the program to call that function and it gave the following error...

How i can add new libraries in the future?

View 14 Replies View Related

Programming :: Using Header Files - Reference And Put Formulas?

Feb 14, 2011

New to programming having issues reference header files.

Not sure how to put the fomula in headers below:

Program

using namespace std;

View 7 Replies View Related

Programming :: Cmake - Using Header Files In Higher Directories ?

Nov 1, 2010

Say I have a directory structure:

And other.c has:

How do I setup the CMakeFiles.txt files in each directory, so the executable "program" (from program.c) is created.

Currently I get the error:

View 1 Replies View Related

Programming :: Codeblocks Plugins And Header Files Location?

Jan 29, 2010

I installed Codeblocks and build some programs, but I have two questions:1. Where are my header files placed, since I don't know where codeblocks is installed. Soemetimes I have to remove header file extension (.h) to be able to compile some source. I use gcc as setting for codeblocks to compile and build programs.2. Plugins for Codeblocks can be installed, but when browse codeblocks's wiki I can't find download links neither developer pages

View 3 Replies View Related

Programming :: Compile C++ Program Without Changing #include Line & Header Files Not System?

Apr 3, 2011

I have C++ source code(*.cpp) files that expects it's header files in System's include folder which is/usr/include.The cpp files has include lines like this:

Code:
#include <some.h>
#include <another.h>

[code]...

View 3 Replies View Related

Programming :: Reading API Files From SO Library

Jul 27, 2010

If we have a .so library elf in linux, will it be possible to find out the APIs supported by it. Or in other words, the functions that can be used along with the argument types and return type.? Note that we dont have any other header files or documentations related to the library.

View 5 Replies View Related

CentOS 5 :: Install Shared Library On 5.2 - Cannot Open Shared Object File: No Such File Or Directory

Feb 11, 2009

I am using Centos 5.2, and I installed all of the available gnome and gnome development libraries available via the "add software" menu item. Still, when running some programs, I get the following error message:

"error while loading shared libraries: libzvt.so.2: cannot open shared object file: No such file or directory"

If I understood it correctly, libzvt.so.2 is part of some gnome libs... where to find and how to install them?

View 5 Replies View Related

Programming :: Patch Binary Files From Different Library?

Jul 2, 2010

I am currently implementing an upgrade system for silent upgrades in my application. I am stuck. I need the code to patch binary files. But I can't find a good third party library. My code is in C# so I would prefer a C# library, but right now I would even go as far as using a library in another language and bind it into my C# code. But I just can't find a good patch/diff library. I must be missing something. Surely there must be some libraries out there that give us the ability to patch binary files?

View 8 Replies View Related

Programming :: Find Sys/types.h File / Library Files?

Mar 24, 2009

can anyone provide me with the path where i can find the library files. stdio.h, sys/types.h.......

View 4 Replies View Related

Programming :: Find Source Code Of C Library Files In Ubuntu?

Feb 26, 2009

Where do i found source code of c library files in ubuntu.

View 2 Replies View Related

Programming :: Shared Libs - Multiple Files In C++?

Oct 20, 2010

I'm trying to change a group of cpp files to one shared lib. I have created a shared lib with a single file. I then did this with a group of files. The difference in what I'm doing is that before with the single file, .a, was added into a single .o file. Now I'm trying to add it to my main.cpp file which is NOT a .o file. I'm now getting these compiler errors from the main.cpp where is doesn't seem to recognize the semaphores.Example Error: undefined reference to `sem_wait'If I were not to use the share libs this compiles and runs as I expected it to.Something tells me this is a compiler flag issue, at least I hope it is

View 1 Replies View Related

Programming :: Compile Shared Object Files Using Valac ?

Oct 20, 2010

What flags do you have to pass to valac to compile code into a shared library (file extension .so)?

View 1 Replies View Related

General :: How To See If Shared Library Is Currently Loaded

Jul 13, 2011

How can I see if a shared library is currently loaded? (i.e. system-wide, process agnostic)How can I see all shared libraries loaded by a process?

View 2 Replies View Related

Ubuntu :: Gcc Shared Library For G++ Application?

May 2, 2011

I built a shared library for some API functions (C files) and compiled them with gcc. Now I'm writing a c++ application (compiling with g++) and want to link my C API shared library and be able to use it from my application. Is this possible? At first instance, it's not quite working for me. I was able to link my shared lib just fine with a C application but got an "undefined reference to `apiFunction()'" error when attempting to do it with g++. Just want to see if anyone has any insight on this subject and make sure this mix is even is allowed.

View 1 Replies View Related

Software :: Cannot Find Shared Library

Feb 18, 2010

I am trying to install the WebSphere MQ Client on a Red Hat Version 5 server with OS x86_64bit.. When I try the first step of there process it fails trying to find shared libraries:ERROR: Installation will not succeed unless the license agreement can be accepted. The MQ Client is 32 bit, but I am told it should work on 64 bit server...

View 2 Replies View Related

Software :: Which Is Best Option To Go With Shared Library?

Nov 19, 2010

I need a design which requires complete modularity and speed. I have a huge monolithic process that i'm seperating now with individual modules as libraries.I'm just worried how to go about the no of shared libraries? for example can i have 10 shared libraries in place of 1? what will be the advantage in that case?

View 2 Replies View Related

Slackware :: Alsaequal Cannot Open Shared Library

Feb 17, 2011

I installed alsaequal URL....l and dependencies ladspa-sdk and caps, all via sbopkg.I'm getting this 'cannot open shared library' error even though that file does in fact exist at the indicated location.Has anyone run into this or successfully installed alsaequal? I also tried on a 13.1 install and got the same result.

View 4 Replies View Related

CentOS 5 :: Shared Library Exists But No Program Can See It?

Jan 12, 2010

I am trying to add some functions to a Postgresql database. The functions use a shared library which they think is: /usr/lib/pgsql/postgis-1.4.so They say: "ERROR: could not load library "/usr/lib/pgsql/postgis-1.4.so": libgeos_c.so.1: cannot open shared object file: No such file or directory"

I cd to /usr/lib/pgsql/ and do an ls. postgis-1.4.so is there. libgeos_c.so.1 is as well (and it's in /usr/lib/ )

Both the files seem to exist. I cannot copy either of them (cp says "cannot stat '[file]': No such file or directory".

View 6 Replies View Related

Ubuntu Multimedia :: ITunes Shared Library On Kubuntu?

Oct 10, 2010

I'd like to know if it is possible to play shared music library of iTunes on Ubuntu.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved