Diff between Shared Object & Shared Lib

Diff between Shared Object & Shared Lib

Post by Rikin Jariwa » Fri, 18 Jul 1997 04:00:00



Hi,

Can anyone give me an idea as to what the difference is between a
shared object and a shared library. I would also appreciate if u could
point me to a good tutorial | site | book.

Thanx,
Rikin

 
 
 

Diff between Shared Object & Shared Lib

Post by Jay Navneeth » Fri, 18 Jul 1997 04:00:00




Quote:

> We want to setup the system as:

> (1). Open a port and waiting for a call from Modem

> (2). If Modem is connected, the program will read the string from Modem

> (3). If 'CONNECT' string is read, do data transfer

> We have some codes which is working on SCO, but not on SUN (please see
> the attachment).  The problem is when Modem is connected, and try to
> read the string, it stops.  The code it stops is:

>    read(fd,data,sdata);  ( in readc() )

> Does anybody have any idea about this.  Is this hardware related? If you
> have done a similar program before, could you please give me some
> refrences if possible?

Hi,

        There are a couple of things that you can try. First , you can check if
the modem's fd has any data that you can read by using a select before the
read. Next, try making the fd a non-blocking fd. This will also mean that
you have to change the design of your read/write functions to handle
EINPROGRESS and similar conditions.

Have fun.

Jay Navneetha

 
 
 

Diff between Shared Object & Shared Lib

Post by Terence Chan » Fri, 18 Jul 1997 04:00:00


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

---559023410-851401618-869154975=:5426
Content-Type: TEXT/PLAIN; charset=US-ASCII

We want to setup the system as:

(1). Open a port and waiting for a call from Modem

(2). If Modem is connected, the program will read the string from Modem

(3). If 'CONNECT' string is read, do data transfer

We have some codes which is working on SCO, but not on SUN (please see
the attachment).  The problem is when Modem is connected, and try to
read the string, it stops.  The code it stops is:

        read(fd,data,sdata);  ( in readc() )

Does anybody have any idea about this.  Is this hardware related? If you
have done a similar program before, could you please give me some
refrences if possible?

Thank you for your help!

Yin

---559023410-851401618-869154975=:5426
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="porttest.c"
Content-Transfer-Encoding: BASE64

Content-Description:

LyogICBUZXN0IFBvcnQgY29udHJvbCAgICovDQoNCiNpbmNsdWRlIDxzdGRp
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GEgeW91IGlucHV0IHdpbGwgYmUg
c2VudCB0byBjb25uZWN0ZWQgc3lzdGVtLlxuIik7DQoJICAgICAgd2hpbGUg
KG1vcmUpDQoJICAgICAgICB7DQoJICAgICAgICAgZmdldHMoIG15YnVmLCAy
NTYsIHN0ZGluKTsNCgkJIGJ5dGVzID0gd3JpdGVjKCBmZCwgbXlidWYsIHN0
cmxlbihteWJ1ZiksIDEwKTsNCgkJfQ0KDQoJICAgfQ0KCSB9DQogICAgICB9
DQogICAgICBieXRlcyA9IGNsb3NlYyggZmQpOw0KfQ0K
---559023410-851401618-869154975=:5426--

 
 
 

Diff between Shared Object & Shared Lib

Post by Andrew Giert » Sat, 19 Jul 1997 04:00:00


 Terence> We have some codes which is working on SCO, but not on SUN
 Terence> (please see the attachment).  The problem is when Modem is
 Terence> connected, and try to read the string, it stops.  The code
 Terence> it stops is:

 Terence>    read(fd,data,sdata);  ( in readc() )

Is CREAD set on the port?

Why are you using ioctls rather than tcgetattr/tcsetattr?

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>

 
 
 

1. semaphors & memory share & object share

You can not just put an object pointer into shared memory and expect it
to work, for the following reason:

In C++ when you instantiate an object that has virtual method
declarations, a virtual jump table is created in the address space
(typically) of the instantiating application.

--
Frank V. Castellucci
http://corelinux.sourceforge.net
OOA/OOD/C++ Standards and Guidelines for Linux

2. Problem with 'newaliases'

3. creating new shared object from existing shared objects ??

4. Mounting CDROM

5. error in loading shared libraries: libXmu.so.6: cannot open shared object

6. PPP problems

7. shared data section in shared objects on AIX

8. Best Free X Windows Server for Win95/98 Box on Samba/Linux Network?

9. Shared libs with g++: Core dump with static global objects

10. Q: constructor not called for global object in solaris shared lib

11. Creating Shared Libs Objects

12. Linking serveral archive libs into shared object

13. linking errors building shared object libs with gcc 2.7.0