Re: Dynamic library



gamehack@xxxxxxxxx wrote:
Hi all,

I've been trying get an example of loading a .so but it doesn't work.
Here's the lib:

#include "stdio.h"

void testme(void)
{
	printf("Hello From Lib!");
}

And this is compiled as:
gcc -fPIC -shared file.c -o libmystuff.so

Then here's the file which tries to load it:
#include "stdio.h"
#include "dlfcn.h"

int main()
{
	printf("Going to call library code\n");

void* handle = dlopen("/home/gamehack/shared/libmystuff.so)",
There we go.
You have a ) at the end of your filename.

Be sure to read the "Program Library Howto" as well.
.



Relevant Pages

  • Re: Question about pointers?
    ... > with the exception of the void fileexistcheckthat is OS ... I hope the rest of it is totally standard. ... > int main ... > void selectfilename(string& filename) ...
    (comp.lang.cpp)
  • File Input Error Help
    ... void NotValid(int, int, int); ... char* filename; ... //coming up with can not convert blah blah blah. ...
    (comp.lang.cpp)
  • Why is sizeof(arrayname)=4 and not 67 in function?
    ... I wrote a function which fgets a filename from the commandline. ... it doesnt help. ... /* hole_text better takes array pointer and int arraysize*/ ... void hole_text{ ...
    (comp.lang.c)
  • Re: problem with reading files and recursively reading directories
    ... Because you're just passing the filename to stat, ... void filesize(char *, struct stat *); ... int main ...
    (comp.unix.programmer)
  • Re: Save/Load DirectDraw.Surface
    ... > What is the best way to save/load a DirectDraw.Surface to disk? ... void SaveSurface(string filename, Surface surface, int width, int height) { ...
    (microsoft.public.win32.programmer.directx.managed)