Bugs item #1727192, was opened at 2007-05-29 01:47
Message generated for change (Comment added) made by pedroalves
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=865514&aid=1727192&group_id=173455

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: w32api
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 5
Private: No
Submitted By: crash025 (crash025)
>Assigned to: Pedro Alves (pedroalves)
Summary: Problems with bind through winsock for bluetooth 

Initial Comment:
Using: arm-wince-cegcc-g++ (GCC) 4.1.0
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I've been having problems with binding to a socket for bluetooth. I've followed 
the MSDN documentation and examples but I keep getting the 10014 (WSAEFAULT) 
[something wrong with the pointer or the size argument is too small] error from 
SOCKADDR_BTH and bind. 

I get the following sizes for the structure
typedef struct _SOCKADDR_BTH
{
    USHORT      addressFamily;  // 2 bytes
    BTH_ADDR    btAddr;         // 8 bytes
    GUID        serviceClassId; // 16 bytes
    ULONG       port;           // 4 bytes
} SOCKADDR_BTH, *PSOCKADDR_BTH;

And the structure is being reported as 32 
   If I remember from class correctly it is because of padding and align 4 
which happens on linux. Another person on another forum is claiming that the 
structure should be 30

Is my winsock code off or is this an internal flaw in the  compiler?

To compile I'm using this line:
 arm-wince-cegcc-g++ -o name.exe gpstobth.cpp -lws2


----------------------------------------------------------------------

>Comment By: Pedro Alves (pedroalves)
Date: 2007-05-29 16:07

Message:
Logged In: YES 
user_id=1370634
Originator: NO

Hi,

Our compiler should give you the same padding as MSVC does.
If you know this structure should be 30 bytes, then the original
SDK header is putting have a pragma pack somewhere, to inhibit
the padding.  Try this instead, it gives 30 bytes for me:

#pragma pack(push)

#pragma pack(1)

typedef struct _SOCKADDR_BTH {
  USHORT addressFamily;
  bt_addr btAddr;
  GUID serviceClassId;
  ULONG port;
} SOCKADDR_BTH, *PSOCKADDR_BTH;

#pragma pack(pop)

If you are able to build a header with these structures
*without* peeking into the SDK, and without copying them from
someone who might, please send it over, and it will
most surely be accepted.  Pointers to MSDN docs showing where
the definitions come from is the best.

Cheers,
Pedro Alves


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=865514&aid=1727192&group_id=173455

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to