Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jul 1999 12:34:58 -0700
From:      "   " <ifsmgr@my-Deja.com>
To:        freebsd-questions@freebsd.org
Subject:   Problem using shared library
Message-ID:  <GHMOIFDFDAIAEAAA@my-deja.com>

next in thread | raw e-mail | index | archive | help
Hello everybody,

I'm new to FreeBSD programming and I need to port some Windows software
that is built of DLLs. As I couldn't find a shared library sample in
/usr/share/examples, I chose, quite arbitrary, the ppp/PAM relationship
to be my starting point. After reading both of them, I cooked something
like this.

FreeBSD 3.2 from CD-ROM
--------
I have the following makefile for my library:

LIB=            my_lib
SHLIB_NAME=     my_lib.so
SRCS=           my_lib.c
CFLAGS+=        -Wall

DPADD+=         ${LIBGCC_PIC}
LDADD+=         -lgcc_pic
.include <bsd.lib.mk>

Make creates my_lib.so in the current directory.
I copy it to the /usr/lib directory and rename to libmy_lib.so

--------
I have the following makefile for my program:

PROG=   my_prog
SRCS=   my_prog.c

#LDADD=  -lcrypt -lutil -lmd
LDADD=  -lmy_lib

.include <bsd.prog.mk>

Make produces the following output:

Warning: Object directory not changed from original /usr/home/stan/server
cc -O -pipe   -c my_prog.c
cc -O -pipe   -o my_prog.o  -lmy_lib
make: don't know how to make my_prog.1. Stop                                 

and creates executable my_prog.

--------
Then, when I run my_prog, it prints:
/usr/libexec/ld-elf.so.1: Shared object "my_lib.so" not found

If I then rename /usr/lib/libmy_lib.so to my_lib.so, it finally
finds the library and runs as expected.

What I'm doing wrong?

Thank you.



--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?GHMOIFDFDAIAEAAA>