| Thread overview | |||||
|---|---|---|---|---|---|
  | 
March 11, 2007 question with c -header file | ||||
|---|---|---|---|---|
  | ||||
hi,
how would the following translate to d, so that it will be callable? i don't have a problem with the struct, but the typedef.
struct _CONNECTION {
    long   Socket;                  // Client long.
    unsigned long  dwIP;                  // Client IP.
    void *pvPerConnectionUserData; // Application-defined value given in callback functions.
} CONNECTION, *PCONNECTION;
typedef BOOL (CALLBACK *ONCONNECTPROC)( PCONNECTION pConnection );
 | ||||
March 11, 2007 Re: question with c -header file | ||||
|---|---|---|---|---|
  | ||||
Posted in reply to kor  | On Sun, 11 Mar 2007 07:25:33 -0400, kor <kor@kor.com> wrote:
>hi,
>
>how would the following translate to d, so that it will be callable? i don't have a problem with the struct, but the typedef.
>
>struct _CONNECTION {
>    long   Socket;                  // Client long.
>    unsigned long  dwIP;                  // Client IP.
>    void *pvPerConnectionUserData; // Application-defined value given in callback functions.
>} CONNECTION, *PCONNECTION;
>
>
>
>typedef BOOL (CALLBACK *ONCONNECTPROC)( PCONNECTION pConnection );
alias int BOOL;
struct CONNECTION
{
	int Socket;
	uint dwIP;
	void* pvPerConnectionUserData;
}
alias CONNECTION* PCONNECTION;
extern(Windows) alias BOOL function(PCONNECTION pConnection)
ONCONNECTPROC;
 | |||
March 12, 2007 Re: question with c -header file | ||||
|---|---|---|---|---|
  | ||||
Posted in reply to Max Samukha  | thanks!
Max Samukha Wrote:
> On Sun, 11 Mar 2007 07:25:33 -0400, kor <kor@kor.com> wrote:
> 
> >hi,
> >
> >how would the following translate to d, so that it will be callable? i don't have a problem with the struct, but the typedef.
> >
> >struct _CONNECTION {
> >    long   Socket;                  // Client long.
> >    unsigned long  dwIP;                  // Client IP.
> >    void *pvPerConnectionUserData; // Application-defined value given in callback functions.
> >} CONNECTION, *PCONNECTION;
> >
> >
> >
> >typedef BOOL (CALLBACK *ONCONNECTPROC)( PCONNECTION pConnection );
> 
> alias int BOOL;
> 
> struct CONNECTION
> {
> 	int Socket;
> 	uint dwIP;
> 	void* pvPerConnectionUserData;
> }
> 
> alias CONNECTION* PCONNECTION;
> 
> extern(Windows) alias BOOL function(PCONNECTION pConnection)
> ONCONNECTPROC;
 | |||
Copyright © 1999-2021 by the D Language Foundation
 
Permalink
Reply