Thread overview
strange problem, need ideas for debugging...
Nov 15, 2005
clayasaurus
Nov 15, 2005
John Reimer
Nov 15, 2005
clayasaurus
Nov 15, 2005
clayasaurus
Nov 15, 2005
clayasaurus
Nov 15, 2005
clayasaurus
Nov 15, 2005
clayasaurus
November 15, 2005
I have a weird problem and I have no clue how to debug it. I have tried but it has burned my brain out.

A brief about the program : Simple client / server chat model example. I am using the C++ raknet lib, so I've created a C wrapper around it.

Here's what I've done...

1) I've created a C wrapper for Raknet.

2) Tested the wrapper in a C++ program using only my C functions. Works fine.

3) created extern(C) D functions to link to the C functions, added -lstdc++ to the D version.

4) Compile, test, run.

I have 2 versions of the program, the C version and D version.

The D server version can't recieve packets, but the D client version can receive packets from the C server and send packets to the C server.

The code is exactly the same for the C and D version, expect the D version has extern(C) linkage.

I did try to debug at the library level (raknet), and found that no packets were even on the queue for the D server version, but they are for the C version, and they are for the D client when 'talking' to the C server.

I have been trying but am all out of ideas how to debug this thing. My mind can't wander far from the assumption that if the C version works and the D version uses the same code, it should work as well.

Thanks

~ Clay

PS. The code is here http://svn.dsource.org/projects/warbots/trunk/cinterface/ if you want to  take a look
November 15, 2005
In article <dlbh2p$26eu$1@digitaldaemon.com>, clayasaurus says...
>
>I have a weird problem and I have no clue how to debug it. I have tried but it has burned my brain out.

<snip>

Are you working on Linux or Windows?  If you are working on Windows, it looks like your rakglue interface is declaring itself extern(C) while your d import code is declaring the rakglue C functions with extern(Windows) linkage.

Or maybe I'm not seeing the picture correctly...

-JJR


November 15, 2005
John Reimer wrote:
> In article <dlbh2p$26eu$1@digitaldaemon.com>, clayasaurus says...
> 
>>I have a weird problem and I have no clue how to debug it. I have tried but it has burned my brain out.
> 
> 
> <snip>
> 
> Are you working on Linux or Windows?  If you are working on Windows, it looks
> like your rakglue interface is declaring itself extern(C) while your d import
> code is declaring the rakglue C functions with extern(Windows) linkage.
> 
> Or maybe I'm not seeing the picture correctly...
> 
> -JJR
> 
> 

I'm working on linux but want to make the code x-platform. Can it be fixed up with the following...

#ifdef _WIN32
extern "Windows" {
#endif

#ifdef LINUX
extern "C" {
#endif

}

?

Thanks

~ Clay
November 15, 2005
I'm not sure if my problem has to do with the Packet structure. I have one defined in the C++ version and one defined in the D version. Is there any way to extern data structures?

clayasaurus wrote:
> I have a weird problem and I have no clue how to debug it. I have tried but it has burned my brain out.
> 
> A brief about the program : Simple client / server chat model example. I am using the C++ raknet lib, so I've created a C wrapper around it.
> 
> Here's what I've done...
> 
> 1) I've created a C wrapper for Raknet.
> 
> 2) Tested the wrapper in a C++ program using only my C functions. Works fine.
> 
> 3) created extern(C) D functions to link to the C functions, added -lstdc++ to the D version.
> 
> 4) Compile, test, run.
> 
> I have 2 versions of the program, the C version and D version.
> 
> The D server version can't recieve packets, but the D client version can receive packets from the C server and send packets to the C server.
> 
> The code is exactly the same for the C and D version, expect the D version has extern(C) linkage.
> 
> I did try to debug at the library level (raknet), and found that no packets were even on the queue for the D server version, but they are for the C version, and they are for the D client when 'talking' to the C server.
> 
> I have been trying but am all out of ideas how to debug this thing. My mind can't wander far from the assumption that if the C version works and the D version uses the same code, it should work as well.
> 
> Thanks
> 
> ~ Clay
> 
> PS. The code is here http://svn.dsource.org/projects/warbots/trunk/cinterface/ if you want to  take a look
November 15, 2005
I tried to fix it by wrapping the packet stuff, but the same exact problem exists.

It is like the library isn't working when I link it to D, maybe something didn't get initialized. Maybe -lstdc++ borks the code. I don't know.

clayasaurus wrote:
> I have a weird problem and I have no clue how to debug it. I have tried but it has burned my brain out.
> 
> A brief about the program : Simple client / server chat model example. I am using the C++ raknet lib, so I've created a C wrapper around it.
> 
> Here's what I've done...
> 
> 1) I've created a C wrapper for Raknet.
> 
> 2) Tested the wrapper in a C++ program using only my C functions. Works fine.
> 
> 3) created extern(C) D functions to link to the C functions, added -lstdc++ to the D version.
> 
> 4) Compile, test, run.
> 
> I have 2 versions of the program, the C version and D version.
> 
> The D server version can't recieve packets, but the D client version can receive packets from the C server and send packets to the C server.
> 
> The code is exactly the same for the C and D version, expect the D version has extern(C) linkage.
> 
> I did try to debug at the library level (raknet), and found that no packets were even on the queue for the D server version, but they are for the C version, and they are for the D client when 'talking' to the C server.
> 
> I have been trying but am all out of ideas how to debug this thing. My mind can't wander far from the assumption that if the C version works and the D version uses the same code, it should work as well.
> 
> Thanks
> 
> ~ Clay
> 
> PS. The code is here http://svn.dsource.org/projects/warbots/trunk/cinterface/ if you want to  take a look
November 15, 2005
In an act of desparation I wrapped the whole entire thing in 1 C function. Suprisingly, it worked. Now I can debug I think.

clayasaurus wrote:
> I tried to fix it by wrapping the packet stuff, but the same exact problem exists.
> 
> It is like the library isn't working when I link it to D, maybe something didn't get initialized. Maybe -lstdc++ borks the code. I don't know.
> 
> clayasaurus wrote:
> 
>> I have a weird problem and I have no clue how to debug it. I have tried but it has burned my brain out.
>>
>> A brief about the program : Simple client / server chat model example. I am using the C++ raknet lib, so I've created a C wrapper around it.
>>
>> Here's what I've done...
>>
>> 1) I've created a C wrapper for Raknet.
>>
>> 2) Tested the wrapper in a C++ program using only my C functions. Works fine.
>>
>> 3) created extern(C) D functions to link to the C functions, added -lstdc++ to the D version.
>>
>> 4) Compile, test, run.
>>
>> I have 2 versions of the program, the C version and D version.
>>
>> The D server version can't recieve packets, but the D client version can receive packets from the C server and send packets to the C server.
>>
>> The code is exactly the same for the C and D version, expect the D version has extern(C) linkage.
>>
>> I did try to debug at the library level (raknet), and found that no packets were even on the queue for the D server version, but they are for the C version, and they are for the D client when 'talking' to the C server.
>>
>> I have been trying but am all out of ideas how to debug this thing. My mind can't wander far from the assumption that if the C version works and the D version uses the same code, it should work as well.
>>
>> Thanks
>>
>> ~ Clay
>>
>> PS. The code is here http://svn.dsource.org/projects/warbots/trunk/cinterface/ if you want to  take a look
November 15, 2005
Fixed plus bug report.

clayasaurus wrote:
> In an act of desparation I wrapped the whole entire thing in 1 C function. Suprisingly, it worked. Now I can debug I think.
> 
> clayasaurus wrote:
> 
>> I tried to fix it by wrapping the packet stuff, but the same exact problem exists.
>>
>> It is like the library isn't working when I link it to D, maybe something didn't get initialized. Maybe -lstdc++ borks the code. I don't know.
>>
>> clayasaurus wrote:
>>
>>> I have a weird problem and I have no clue how to debug it. I have tried but it has burned my brain out.
>>>
>>> A brief about the program : Simple client / server chat model example. I am using the C++ raknet lib, so I've created a C wrapper around it.
>>>
>>> Here's what I've done...
>>>
>>> 1) I've created a C wrapper for Raknet.
>>>
>>> 2) Tested the wrapper in a C++ program using only my C functions. Works fine.
>>>
>>> 3) created extern(C) D functions to link to the C functions, added -lstdc++ to the D version.
>>>
>>> 4) Compile, test, run.
>>>
>>> I have 2 versions of the program, the C version and D version.
>>>
>>> The D server version can't recieve packets, but the D client version can receive packets from the C server and send packets to the C server.
>>>
>>> The code is exactly the same for the C and D version, expect the D version has extern(C) linkage.
>>>
>>> I did try to debug at the library level (raknet), and found that no packets were even on the queue for the D server version, but they are for the C version, and they are for the D client when 'talking' to the C server.
>>>
>>> I have been trying but am all out of ideas how to debug this thing. My mind can't wander far from the assumption that if the C version works and the D version uses the same code, it should work as well.
>>>
>>> Thanks
>>>
>>> ~ Clay
>>>
>>> PS. The code is here http://svn.dsource.org/projects/warbots/trunk/cinterface/ if you want to  take a look