public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* [A] It works! : How to create objects of a class defined in .so file?
@ 2000-12-07  6:16 Rajesh Lolam
  2000-12-07  7:24 ` Where are the socket libraries? Robert Nail
  0 siblings, 1 reply; 9+ messages in thread
From: Rajesh Lolam @ 2000-12-07  6:16 UTC (permalink / raw)
  To: gcc-help

Hi all,
	When I started the work, the issues were
1> How to create objects of a class defined in .so file?
2> How to call methods of a class defined in .so file?
	It is possible with (what I think as) a work-around.
	One has to write a wrapper-function, which will 
create objects of a class (which you want to define in
the .so file). The same way you can access the class
methods. After doing this, encapsulate this wrapper
function in the same .so file. 
	The wrapper function can be dynamically linked
using dlfcn.h family functions.
	This way, the objects can be created with the
help of Wrapper-function.
Regards,
Rajesh.
<rajeshlolam@rediffmail.com>
=========================================================



_____________________________________________________
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com

Participate in crazy auctions at http://auctions.rediff.com/auctions/



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Where are the socket libraries?
  2000-12-07  6:16 [A] It works! : How to create objects of a class defined in .so file? Rajesh Lolam
@ 2000-12-07  7:24 ` Robert Nail
  2000-12-07  8:36   ` Alexandre Oliva
  2000-12-07 21:11   ` Where are the socket libraries? Curtis R Anderson
  0 siblings, 2 replies; 9+ messages in thread
From: Robert Nail @ 2000-12-07  7:24 UTC (permalink / raw)
  To: gcc-help

I try to link a simple socket program for Linux 6.0 but it can't find the
SOCKADDR structure. Any ideas would be appreciated.

Thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Where are the socket libraries?
  2000-12-07  7:24 ` Where are the socket libraries? Robert Nail
@ 2000-12-07  8:36   ` Alexandre Oliva
  2000-12-08  6:56     ` Robert Nail
  2000-12-14 14:58     ` Linux RedHat 7.0 Gcc Howard Gilbert
  2000-12-07 21:11   ` Where are the socket libraries? Curtis R Anderson
  1 sibling, 2 replies; 9+ messages in thread
From: Alexandre Oliva @ 2000-12-07  8:36 UTC (permalink / raw)
  To: Robert Nail; +Cc: gcc-help

On Dec  7, 2000, "Robert Nail" <robert.nail@entact.net> wrote:

> I try to link a simple socket program for Linux 6.0 but it can't find the
> SOCKADDR structure.

This will list the header files you may have to include to get its
definition:

grep -l -r SOCKADDR /usr/include

Then, you may have to link your program with some libraries (!= header
files) to get definitions of whatever functions you use.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Where are the socket libraries?
  2000-12-07  7:24 ` Where are the socket libraries? Robert Nail
  2000-12-07  8:36   ` Alexandre Oliva
@ 2000-12-07 21:11   ` Curtis R Anderson
  1 sibling, 0 replies; 9+ messages in thread
From: Curtis R Anderson @ 2000-12-07 21:11 UTC (permalink / raw)
  To: Robert Nail; +Cc: gcc-help

Robert Nail wrote:
> 
> I try to link a simple socket program for Linux 6.0 but it can't find the
> SOCKADDR structure. Any ideas would be appreciated.

Try:
#include <sys/socket.h>
-- 
Curtis R. Anderson, Co-creator of "Gleepy the Hen", SP 2.5?, KoX
No digital wireless, no xDSL, no pagers. Keeps the riff-raff out.
http://www.madbbs.com/users/gleepy/    ICQ: 50137888
mailto:gleepy@intelligencia.com        UTM: PS 7036 7315, zone 17

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Where are the socket libraries?
  2000-12-07  8:36   ` Alexandre Oliva
@ 2000-12-08  6:56     ` Robert Nail
  2000-12-08 13:20       ` Alexandre Oliva
  2000-12-14 14:58     ` Linux RedHat 7.0 Gcc Howard Gilbert
  1 sibling, 1 reply; 9+ messages in thread
From: Robert Nail @ 2000-12-08  6:56 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc-help

The source I have is below:

The error messages I get when trying to gcc this stuff is:

request for member "sin_family" in something not a structure or union
request for member "sin_addr" in something not a structure or union
request for member "sin_port" in something not a structure or union

The only place I can find sin_family and such is on /usr/include/linux/in.h.
I have tried to include <linux/in.h> but it makes no difference.  All help
will be appreciated.  Thanks

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>


main()
{
 int i,j;
 int sock1;
 char ibuf[BUFSIZ];

 struct sockaddr *serv;
 memset(&serv,0,sizeof(serv));

 serv.sin_family = AF_INET;
 serv.sin_addr.s_addr = inet_addr("333.444.555.6");
 serv.sin_port = htons(777);

 if(connect(sock1, (struct sockaddr*) &serv,sizeof(serv)) < 0)
  printf("Error on connect\n");

 i = write(sock1,"This is test1",13);
 i = read(sock1,ibuf,20);
 printf("Ibuf: %s\n",ibuf);
}


----- Original Message -----
From: "Alexandre Oliva" <aoliva@redhat.com>
To: "Robert Nail" <robert.nail@entact.net>
Cc: <gcc-help@gcc.gnu.org>
Sent: Thursday, December 07, 2000 10:36 AM
Subject: Re: Where are the socket libraries?


> On Dec  7, 2000, "Robert Nail" <robert.nail@entact.net> wrote:
>
> > I try to link a simple socket program for Linux 6.0 but it can't find
the
> > SOCKADDR structure.
>
> This will list the header files you may have to include to get its
> definition:
>
> grep -l -r SOCKADDR /usr/include
>
> Then, you may have to link your program with some libraries (!= header
> files) to get definitions of whatever functions you use.
>
> --
> Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
> Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
> CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
> Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Where are the socket libraries?
  2000-12-08  6:56     ` Robert Nail
@ 2000-12-08 13:20       ` Alexandre Oliva
  0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Oliva @ 2000-12-08 13:20 UTC (permalink / raw)
  To: Robert Nail; +Cc: gcc-help

On Dec  8, 2000, "Robert Nail" <robert.nail@entact.net> wrote:

> request for member "sin_family" in something not a structure or union
> request for member "sin_addr" in something not a structure or union
> request for member "sin_port" in something not a structure or union

serv is a pointer, so use `->' instead of `.'.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Linux RedHat 7.0 Gcc
  2000-12-07  8:36   ` Alexandre Oliva
  2000-12-08  6:56     ` Robert Nail
@ 2000-12-14 14:58     ` Howard Gilbert
  2000-12-15  8:57       ` Edward S. Marshall
  1 sibling, 1 reply; 9+ messages in thread
From: Howard Gilbert @ 2000-12-14 14:58 UTC (permalink / raw)
  To: gcc-help

Hi,

I recently installed RH7.0 and have had little subsequent success with
compiling downloaded software. 

Most recently I tied to reconfigure and compile the kernel and got
hundreds of parse error messages (these errors were occuring in the .h
files but they all seemed perfectly OK to me).

On mentioning this to other Linux users I've been told by one that Red Hat
used a non-stable version of gcc in v7.0 and by another that Red Hat used
a different non-stable compiler for the kernel.

Does anyone know if these things are true and, if so, what is the best way
round it and, if not, what is the likely cause of the many parse errors. 


My system gives:-

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$ gcc -v 
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.0)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  

-- 
Thanks and
Best wishes,
Howard.
(Dr A.H.Gilbert, Thornaby-on-Tees, Nth Yorkshire.)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Linux RedHat 7.0 Gcc
  2000-12-14 14:58     ` Linux RedHat 7.0 Gcc Howard Gilbert
@ 2000-12-15  8:57       ` Edward S. Marshall
  0 siblings, 0 replies; 9+ messages in thread
From: Edward S. Marshall @ 2000-12-15  8:57 UTC (permalink / raw)
  To: Howard Gilbert; +Cc: gcc-help

On Thu, 14 Dec 2000, Howard Gilbert wrote:
> On mentioning this to other Linux users I've been told by one that Red Hat
> used a non-stable version of gcc in v7.0 and by another that Red Hat used
> a different non-stable compiler for the kernel.

Yes. Install the package "kgcc", if you haven't already, and modify your
kernel Makefile to use "kgcc" for CC instead of "gcc". 2.2.18 and 2.4.x
should not require any modification; they should pick up on the existance
of kgcc automatically.

Questions relating to Red Hat Linux version 7.0 are best directed to the
Guinness mailing list. Please see the following URL for more information
about joining the list, and to browse the archives (where this question
has been answered quite a few times):

    https://listman.redhat.com/mailman/listinfo/guinness-list

-- 
Edward S. Marshall <emarshall@mercantec.com>                 UNIX Administrator
http://www.nyx.net/~emarshal/                                   Mercantec, Inc.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: Where are the socket libraries?
@ 2000-12-08 11:33 Anderjaska, John
  0 siblings, 0 replies; 9+ messages in thread
From: Anderjaska, John @ 2000-12-08 11:33 UTC (permalink / raw)
  To: 'Robert Nail', Alexandre Oliva; +Cc: gcc-help

Hi,

I'll put in my 2 cents on this one.  First of all I don't think
"333.444.555.6" is a valid IP address.  There may be a conversion problem
w/inet_addr.  Also I suspect your assignments of 'serv'.  It also appears
that you did not setup the transport end point.  You might try this:

#include <sys/socket.h>
#include <netinet/in.h>
#define SvrSocketNo 777
#define SIZE sizeof(struct sockaddr_in)

int sockfd;
char c;

struct sockaddr_in server = {AF_INET, SvrSocketNo};
sockfd = (int)socket(AF_INET, SOCK_STREAM,0);
connect(sockfd, (struct sockaddr *)&server, SIZE);
.
.
.
len = send(sockfd, &c, 1, 0);
**************************************************

Good Luck .. John

*************************************************

The source I have is below:

The error messages I get when trying to gcc this stuff is:

request for member "sin_family" in something not a structure or union
request for member "sin_addr" in something not a structure or union
request for member "sin_port" in something not a structure or union

The only place I can find sin_family and such is on /usr/include/linux/in.h.
I have tried to include <linux/in.h> but it makes no difference.  All help
will be appreciated.  Thanks

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>


main()
{
 int i,j;
 int sock1;
 char ibuf[BUFSIZ];

 struct sockaddr *serv;
 memset(&serv,0,sizeof(serv));

 serv.sin_family = AF_INET;
 serv.sin_addr.s_addr = inet_addr("333.444.555.6");
 serv.sin_port = htons(777);

 if(connect(sock1, (struct sockaddr*) &serv,sizeof(serv)) < 0)
  printf("Error on connect\n");

 i = write(sock1,"This is test1",13);
 i = read(sock1,ibuf,20);
 printf("Ibuf: %s\n",ibuf);
}


----- Original Message -----
From: "Alexandre Oliva" <aoliva@redhat.com>
To: "Robert Nail" <robert.nail@entact.net>
Cc: <gcc-help@gcc.gnu.org>
Sent: Thursday, December 07, 2000 10:36 AM
Subject: Re: Where are the socket libraries?


> On Dec  7, 2000, "Robert Nail" <robert.nail@entact.net> wrote:
>
> > I try to link a simple socket program for Linux 6.0 but it can't find
the
> > SOCKADDR structure.
>
> This will list the header files you may have to include to get its
> definition:
>
> grep -l -r SOCKADDR /usr/include
>
> Then, you may have to link your program with some libraries (!= header
> files) to get definitions of whatever functions you use.
>
> --
> Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
> Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
> CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
> Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2000-12-15  8:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-07  6:16 [A] It works! : How to create objects of a class defined in .so file? Rajesh Lolam
2000-12-07  7:24 ` Where are the socket libraries? Robert Nail
2000-12-07  8:36   ` Alexandre Oliva
2000-12-08  6:56     ` Robert Nail
2000-12-08 13:20       ` Alexandre Oliva
2000-12-14 14:58     ` Linux RedHat 7.0 Gcc Howard Gilbert
2000-12-15  8:57       ` Edward S. Marshall
2000-12-07 21:11   ` Where are the socket libraries? Curtis R Anderson
2000-12-08 11:33 Anderjaska, John

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).