public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Help me
@ 2001-02-13 10:16 David Korn
  0 siblings, 0 replies; 12+ messages in thread
From: David Korn @ 2001-02-13 10:16 UTC (permalink / raw)
  To: gcc-help

-----Original Message-----
From: Pietro [ mailto:kpietro@inwind.it ]
Sent: 13 February 2001 17:41

>Hello ML

  Hello Pietro

>I have the program for scan ports, in the which there is :

    [snip]

>With gcc -g -oprova prova.c   is ok! 
>No error.
>When run the program (prova) in the gdb, subsequently line
> if (connect(sock, (struct sockaddr*)&sin, sizeof(sin))==0)
>write the command print connect.
>The result is :
>$1 = {< text variable, no debug info >} 0x400c9ca0 <__libc_connect>
>Why ?
>The result of connect no egual -1 (error connecting) or 0 
>(connecting ok) ?

  This question would belong even better on the "All Binary Use Sockets
Exchange" mailing list instead, so why not send your question to the 
address abuse@inwind.it ?  I'm sure they'll give you a good answer.

       DaveK
-- 
we are not seats or eyeballs or end users or consumers.
we are human beings - and our reach exceeds your grasp.
                    deal with it.                      - cluetrain.org 



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

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

* Re: help me
  2014-03-19  7:24   ` Ángel González
@ 2014-03-19 19:56     ` Ali Abdul Ghani
  0 siblings, 0 replies; 12+ messages in thread
From: Ali Abdul Ghani @ 2014-03-19 19:56 UTC (permalink / raw)
  To: Ángel González; +Cc: Andy Falanga (afalanga), gcc-help

Thanks
Construction has been successfully


2014-03-18 16:30 جرينتش-07:00, Ángel González <keisial@gmail.com>:
> Andy Falanga (afalanga) wrote:
>> Other than that, it's not clear if you're building for Windows or not.  It
>> looks like, if GCC wasn't compiled for Windows support, it may not know
>> how to handle the __declspec() syntax.  Look through the GCC docs for more
>> info.
>>
>> Andy
> Additionally, you need to remove the static qualifier from both the
> prototype (so it doesn't search the library in the program instead of
> the dl) and in the library (defining as static prevents it to be
> exported), You will also have to provide a definition for MAP in your
> header (or at least a forward declaration),
>
>
>
>


-- 
Think not of them, thou hast thy music too

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

* Re: help me
  2014-03-18 23:30 ` Andy Falanga (afalanga)
@ 2014-03-19  7:24   ` Ángel González
  2014-03-19 19:56     ` Ali Abdul Ghani
  0 siblings, 1 reply; 12+ messages in thread
From: Ángel González @ 2014-03-19  7:24 UTC (permalink / raw)
  To: blade.vp2020; +Cc: Andy Falanga (afalanga), gcc-help

Andy Falanga (afalanga) wrote:
> Other than that, it's not clear if you're building for Windows or not.  It looks like, if GCC wasn't compiled for Windows support, it may not know how to handle the __declspec() syntax.  Look through the GCC docs for more info.
>
> Andy
Additionally, you need to remove the static qualifier from both the 
prototype (so it doesn't search the library in the program instead of 
the dl) and in the library (defining as static prevents it to be 
exported), You will also have to provide a definition for MAP in your 
header (or at least a forward declaration),



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

* RE: help me
  2014-03-18 21:03 help me Ali Abdul Ghani
@ 2014-03-18 23:30 ` Andy Falanga (afalanga)
  2014-03-19  7:24   ` Ángel González
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Falanga (afalanga) @ 2014-03-18 23:30 UTC (permalink / raw)
  To: gcc-help

> 
> hi list
> I need help
>  I make Dynamic-link library in c
> I want link it from a C++
> 
> I Create .h file like this
> #ifdef __cplusplus
> extern "C" {  // only need to export C interface if
>               // used by C++ source code #endif __declspec( dllimport )
>     static void flood_loop(MAP *map, int x, int y,
>       unsigned int dst_c, unsigned  int src_c); #ifdef __cplusplus }
> #endif


I made the mistake earlier of *not* replying to all on this one.  So, here's my question to the OP with his response:

AF> How do you know it doesn't work?  What are the error messages?

ALI> 5: error: expected `,' or `...' before '(' token
ALI> 		5: error: expected `)' before ';' token
ALI> 5: error: storage class specifiers invalid in parameter declarations
ALI> 5: error: storage class specified for parameter `flood_loop'
ALI> 5: error: `flood_loop' has incomplete type
ALI> 5: error: invalid use of `void'

I don't know if the formatting is messed up because of copy/paste issues but the first thing I'd try is making sure that the #endif directives are on lines by themselves.

#ifdef __cplusplus
extern "C" {
#endif

// stuff

#ifdef __cplusplus
}
#endif

Other than that, it's not clear if you're building for Windows or not.  It looks like, if GCC wasn't compiled for Windows support, it may not know how to handle the __declspec() syntax.  Look through the GCC docs for more info.

Andy

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

* help me
@ 2014-03-18 21:03 Ali Abdul Ghani
  2014-03-18 23:30 ` Andy Falanga (afalanga)
  0 siblings, 1 reply; 12+ messages in thread
From: Ali Abdul Ghani @ 2014-03-18 21:03 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

hi list
I need help
 I make Dynamic-link library in c
I want link it from a C++

I Create .h file like this
#ifdef __cplusplus
extern "C" {  // only need to export C interface if
              // used by C++ source code
#endif
__declspec( dllimport )     static void flood_loop(MAP *map, int x,
int y,                           unsigned int dst_c, unsigned  int
src_c);
#ifdef __cplusplus
}
#endif

but cannot work

-- 
Think not of them, thou hast thy music too

[-- Attachment #2: rose.c --]
[-- Type: text/x-csrc, Size: 6059 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <stddef.h>
    #define BOARD_WIDTH  10  
    #define BOARD_HEIGHT 20  
      
    typedef struct MAP  
    {  
      unsigned char b[BOARD_HEIGHT][BOARD_WIDTH];  
    } MAP;  
    static void flood_loop(MAP *map, int x, int y,  
                           unsigned int dst_c, unsigned  int src_c)  
    {  
      int fillL, fillR, i;  
      int in_line = 1;  
      //unsigned char c = src_c, fillC = dst_c;  
      
      /* find left side, filling along the way */  
      fillL = fillR = x;  
      while( in_line )  
      {  
        map->b[y][fillL] = dst_c;  
        fillL--;  
        in_line = (fillL < 0) ? 0 : (map->b[y][fillL] == src_c);  
      }  
      fillL++;  
      /* find right side, filling along the way */  
      in_line = 1;  
      while( in_line )  
      {  
        map->b[y][fillR] = dst_c;  
        fillR++;  
        in_line = (fillR > BOARD_WIDTH-1) ? 0 : (map->b[y][fillR] == src_c);  
      }  
      fillR--;  
      /* search top and bottom */  
      for(i = fillL; i <= fillR; i++)  
      {  
        if( y > 0 && map->b[y - 1][i] == src_c )  
            flood_loop(map, i, y - 1, dst_c, src_c);  
        if( y < BOARD_HEIGHT-1 && map->b[y + 1][i] == src_c )  
            flood_loop(map, i, y + 1, dst_c, src_c);  
      }  
    }  
    void flood_fill(MAP *map, int x, int y, unsigned int c)  
    {  
      flood_loop(map, x, y, c, map->b[y][x]);  
      map->b[y][x] = c;  /* some buggy optimizers needed this line */  
    }  


char Taq(char* number)
{
  const char taqDhmd111rr[]=
    "0317598642""7092154863""4206871359""1750983426""6123045978"
    "3674209581""5869720134""8945362017""9438617205""2581436790";
  char interim='0';
  char* p;
  for(p=number;*p!='\0';++p){
    if((unsigned char)(*p-'0')>9)
      return '-'; //minus sign indicates an error: character is not a digit
    interim=taqDhmd111rr[(*p-'0')+(interim-'0')*10];
  }
  return interim;
}
char CalculateCheckDigit(char* numberWithoutCheckDigit)
{
  return Taq(numberWithoutCheckDigit);
}
 typedef int BOOL;
BOOL IsCheckDigitValid(char* numberWithCheckDigit)
{
  return Taq(numberWithCheckDigit)=='0';
}
int kmp_search(char W[], char S[])
{
int t[500000000];
    int m = 0;
    int i = 0;
    
    while (S[m + i] != '\0' && W[i] != '\0') {
        if (S[m + i] == W[i]) {
            ++i;
        } else {
            m += i - t[i];
            if (i > 0) i = t[i];
        }
    }
        if (W[i] == '\0') {
        return m;
    } else {
        return m + i;
    }
}

void selection_sort (int *a, int n) {
    int i, j, m, t;
    for (i = 0; i < n; i++) {
        for (j = i, m = i; j < n; j++) {
            if (a[j] < a[m])
                m = j;
        }
        t = a[i];
        a[i] = a[m];
        a[m] = t;
    }
}

void shell_sort (int *a, int n) {
    int h, i, j, k;
    for (h = n; h /= 2;) {
        for (i = h; i < n; i++) {
            k = a[i];
            for (j = i; j >= h && k < a[j - h]; j -= h) {
                a[j] = a[j - h];
            }
            a[j] = k;
        }
    }
}
static void insertion_sort(int *a, const size_t n) {
    size_t i, j;
    int value;
    for (i = 1; i < n; i++) {
        value = a[i];
        for (j = i; j > 0 & value < a[j - 1]; j--) {
            a[j] = a[j - 1];
        }
        a[j] = value;
    }
}
void gnome_sort(int *a, int n)
{
  int i=1, j=2, t;
# define swap(i, j) { t = a[i]; a[i] = a[j]; a[j] = t; } 
  while(i < n) {
    if (a[i - 1] > a[i]) {
      swap(i - 1, i);
      if (--i) continue;
    }
    i = j++;
  }
# undef swap
}
#define try_swap { if (aa[ii] < aa[ii - 1])\
	{ tt = aa[ii]; aa[ii] = aa[ii - 1]; aa[ii - 1] = tt; tt = 0;} }
void cocktailsort(int *aa, size_t len)
{
	size_t ii;
	int tt = 0;
	while (!tt) {
		for (ii = 1, tt = 1; ii < len; ii++) try_swap;
		if (tt) break;
		for (ii = len - 1, tt = 1; ii; ii--) try_swap;
	}
}
void bubble_sort(int *a, int n) {
	int j, t = 1;
	while (n-- & t)
		for (j = t = 0; j < n; j++) {
			if (a[j] <= a[j + 1]) continue;
			t = a[j], a[j] = a[j + 1], a[j + 1] = t;
			t=1;
		}
}
void quick_sort (int *a, int n) {
if (n < 2)
return;
int p = a[n / 2];
int *l = a;
int *r = a + n - 1;
while (l <= r) {
if (*l < p) {
l++;
continue;
}
if (*r > p) {
r--;
continue; // we need to check the condition (l <= r) every time we change the value of l or r
}
int t = *l;
*l++ = *r;
*r-- = t;
}
quick_sort(a, r - a + 1);
quick_sort(l, a + n - l);
}
void bead_sort(int *a, int len)
{
int i, j, max, sum;
unsigned char *beads;
#define BEAD(i, j) beads[i * max + j]
for (i = 1, max = a[0]; i < len; i++)
		if (a[i] > max) max = a[i];
beads = calloc(1, max * len);
/* mark the beads */
	for (i = 0; i < len; i++)
		for (j = 0; j < a[i]; j++)
			BEAD(i, j) = 1;
for (j = 0; j < max; j++) {
		/* count how many beads are on each post */
		for (sum = i = 0; i < len; i++) {
			sum += BEAD(i, j);
			BEAD(i, j) = 0;
		}
		/* mark bottom sum beads */
		for (i = len - sum; i < len; i++) BEAD(i, j) = 1;
	}
for (i = 0; i < len; i++) {
		for (j = 0; j < max & BEAD(i, j); j++);
		a[i] = j;
	}
	
free(beads);
}
void merge(int numbers[], int temp[], int left, int mid, int right)
{
int i, left_end, num_elements, tmp_pos;
left_end = mid - 1;
tmp_pos = left;
num_elements = right - left + 1;
while ((left <= left_end) && (mid <= right))
{
if (numbers[left] <= numbers[mid])
{
temp[tmp_pos] = numbers[left];
tmp_pos = tmp_pos + 1;
left = left +1;
}
else
{
temp[tmp_pos] = numbers[mid];
tmp_pos = tmp_pos + 1;
mid = mid + 1;
}
}
while (left <= left_end)
{
temp[tmp_pos] = numbers[left];
left = left + 1;
tmp_pos = tmp_pos + 1;
}
while (mid <= right)
{
temp[tmp_pos] = numbers[mid];
mid = mid + 1;
tmp_pos = tmp_pos + 1;
}
for (i=0; i <= num_elements; i++)
{
numbers[right] = temp[right];
right = right - 1;
}
}

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

* Help me
@ 2001-02-14 13:31 Pietro
  0 siblings, 0 replies; 12+ messages in thread
From: Pietro @ 2001-02-14 13:31 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

Hello ML
I have the program for scan ports, in the which there is :

         sin.sin_family=AF_INET;
         sin.sin_port=htons(110);
         sin.sin_addr.s_addr=htonl(counter);
         addr.s_addr=htonl(counter);
         bzero(&(sin.sin_zero),
8);
        
         if
(connect(sock, (struct sockaddr*)&sin, sizeof(sin))==0)
          
{
           
read(sock, buffer, sizeof(buffer));
           if
(strstr(buffer, "QPOP") != NULL)
            
{
               
fprintf(stdout, "FOUND : %s\n", inet_ntoa(addr));
            
}
          }

With gcc -g -oprova prova.c   is ok! 
No error.
When run the program (prova) in the gdb, subsequently line
 if (connect(sock, (struct sockaddr*)&sin,
sizeof(sin))==0)
write the command print connect.
The result is :
$1 = {< text variable, no debug info >} 0x400c9ca0
<__libc_connect>
Why ?
The result of connect no egual -1 (error connecting) or 0 (connecting ok)
?

Help me
Thanks
Ciao by italy


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

* Help me
@ 2001-02-13 10:54 Pietro
  0 siblings, 0 replies; 12+ messages in thread
From: Pietro @ 2001-02-13 10:54 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

Hello ML
I have the program for scan ports, in the which there is :

         sin.sin_family=AF_INET;
         sin.sin_port=htons(110);
         sin.sin_addr.s_addr=htonl(counter);
         addr.s_addr=htonl(counter);
         bzero(&(sin.sin_zero),
8);
        
         if
(connect(sock, (struct sockaddr*)&sin, sizeof(sin))==0)
          
{
           
read(sock, buffer, sizeof(buffer));
           if
(strstr(buffer, "QPOP") != NULL)
            
{
               
fprintf(stdout, "FOUND : %s\n", inet_ntoa(addr));
            
}
          }

With gcc -g -oprova prova.c   is ok! 
No error.
When run the program (prova) in the gdb, subsequently line
 if (connect(sock, (struct sockaddr*)&sin,
sizeof(sin))==0)
write the command print connect.
The result is :
$1 = {< text variable, no debug info >} 0x400c9ca0
<__libc_connect>
Why ?
The result of connect no egual -1 (error connecting) or 0 (connecting ok)
?

Help me
Thanks
Ciao by italy


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

* Help me
@ 2001-02-13  9:43 Pietro
  0 siblings, 0 replies; 12+ messages in thread
From: Pietro @ 2001-02-13  9:43 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

Hello ML
I have the program for scan ports, in the which there is :

         sin.sin_family=AF_INET;
         sin.sin_port=htons(110);
         sin.sin_addr.s_addr=htonl(counter);
         addr.s_addr=htonl(counter);
         bzero(&(sin.sin_zero),
8);
        
         if
(connect(sock, (struct sockaddr*)&sin, sizeof(sin))==0)
          
{
           
read(sock, buffer, sizeof(buffer));
           if
(strstr(buffer, "QPOP") != NULL)
            
{
               
fprintf(stdout, "FOUND : %s\n", inet_ntoa(addr));
            
}
          }

With gcc -g -oprova prova.c   is ok! 
No error.
When run the program (prova) in the gdb, subsequently line
 if (connect(sock, (struct sockaddr*)&sin,
sizeof(sin))==0)
write the command print connect.
The result is :
$1 = {< text variable, no debug info >} 0x400c9ca0
<__libc_connect>
Why ?
The result of connect no egual -1 (error connecting) or 0 (connecting ok)
?

Help me
Thanks
Ciao by italy


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

* Re: help me
  2000-05-12  9:54 help me Zille Eizad
@ 2000-05-12 13:18 ` Alexandre Oliva
  0 siblings, 0 replies; 12+ messages in thread
From: Alexandre Oliva @ 2000-05-12 13:18 UTC (permalink / raw)
  To: Zille Eizad; +Cc: help-gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

On May 12, 2000, "Zille Eizad" <zarb@comsats.net.pk> wrote:

> the problem is i need to find out which library functions are
> defined in which files and what header files are required for them?

GCC is a compiler, it doesn't contain a C library.

-- 
Alexandre Oliva    Enjoy Guaraná, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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

* help me
@ 2000-05-12  9:54 Zille Eizad
  2000-05-12 13:18 ` Alexandre Oliva
  0 siblings, 1 reply; 12+ messages in thread
From: Zille Eizad @ 2000-05-12  9:54 UTC (permalink / raw)
  To: help-gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

what i m trying to do is port gcc on power pc ppc405. i need to find out 
how much of the source code of gcc is written in assembly. well thats not a 
problem. but the problem is i need to find out which library functions are 
defined in which files and what header files are required for them? so i can 
eliminate any unwanted functions and make the library slim. it will be nice to 
get some help in this regard.
 
zille eizad

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

* Re: Help me
  1999-10-01  0:00 Help me Philipp Thomas
@ 1999-10-01  0:00 ` Jeffrey A Law
  0 siblings, 0 replies; 12+ messages in thread
From: Jeffrey A Law @ 1999-10-01  0:00 UTC (permalink / raw)
  To: Philipp Thomas; +Cc: gcc-help

What kind of help do you want?


We've got a little problem with the list names.

The standard ezmlm setup expects <listname>-help to be an autoresponder
to help requests.

However we have a list called "gcc-help".

Ugh.  Unpleasant.

If you are looking for help with the list software, see the "List-Help"
header in messages you get from the list.
jeff

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

* Help me
@ 1999-10-01  0:00 Philipp Thomas
  1999-10-01  0:00 ` Jeffrey A Law
  0 siblings, 1 reply; 12+ messages in thread
From: Philipp Thomas @ 1999-10-01  0:00 UTC (permalink / raw)
  To: gcc-help



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

end of thread, other threads:[~2014-03-19 15:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-13 10:16 Help me David Korn
  -- strict thread matches above, loose matches on Subject: below --
2014-03-18 21:03 help me Ali Abdul Ghani
2014-03-18 23:30 ` Andy Falanga (afalanga)
2014-03-19  7:24   ` Ángel González
2014-03-19 19:56     ` Ali Abdul Ghani
2001-02-14 13:31 Help me Pietro
2001-02-13 10:54 Pietro
2001-02-13  9:43 Pietro
2000-05-12  9:54 help me Zille Eizad
2000-05-12 13:18 ` Alexandre Oliva
1999-10-01  0:00 Help me Philipp Thomas
1999-10-01  0:00 ` Jeffrey A Law

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).