Library failing

View: New views
6 Messages — Rating Filter:   Alert me  

Library failing

by Mathew Benson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I wrote a utility to abstract sending a data buffer to a central server with a single function call.  I verified it works, and then split out the functionality into a library (.lib).  I tried using it in a test application, but keep getting an "Access violation reading location 0x00000000" error.  It occurs in the call:

socket_.async_receive_from(
        boost::asio::buffer(data_, max_length), sender_endpoint_,
        boost::bind(&CommIn::handle_receive_from, this,
        boost::asio::placeholders::error,
        boost::asio::placeholders::bytes_transferred));

I'm using Visual C++ 2005 Express, and a UML to C++ modeler and code generator called Rhapsody.  I'm not sure where to even begin troubleshooting this.  

_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: Library failing

by OvermindDL1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 6, 2009 at 3:08 PM, Mathew Benson <mathew.benson@...> wrote:

> I wrote a utility to abstract sending a data buffer to a central server with
> a single function call.  I verified it works, and then split out the
> functionality into a library (.lib).  I tried using it in a test
> application, but keep getting an "Access violation reading location
> 0x00000000" error.  It occurs in the call:
> socket_.async_receive_from(
>         boost::asio::buffer(data_, max_length), sender_endpoint_,
>         boost::bind(&CommIn::handle_receive_from, this,
>         boost::asio::placeholders::error,
>         boost::asio::placeholders::bytes_transferred));
> I'm using Visual C++ 2005 Express, and a UML to C++ modeler and code
> generator called Rhapsody.  I'm not sure where to even begin troubleshooting
> this.

Debug into it and see what pointer is null at that call, then find out
where that pointer should be set and why it is not.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: Library failing

by Mathew Benson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It took a while to figure out the parameters, but boost::bind,  
boost::asio::placeholders::bytes_transferred, and  
boost::asio::placeholders::error were all null.  I can't figure out  
what I d differently that it worked when is was combined but broke in  
a library.  How do I set these?  Is there a boost init call?

Sent from my iPhone

On Nov 6, 2009, at 7:44 PM, OvermindDL1 <overminddl1@...> wrote:

> On Fri, Nov 6, 2009 at 3:08 PM, Mathew Benson  
> <mathew.benson@...> wrote:
>> I wrote a utility to abstract sending a data buffer to a central  
>> server with
>> a single function call.  I verified it works, and then split out the
>> functionality into a library (.lib).  I tried using it in a test
>> application, but keep getting an "Access violation reading location
>> 0x00000000" error.  It occurs in the call:
>> socket_.async_receive_from(
>>         boost::asio::buffer(data_, max_length), sender_endpoint_,
>>         boost::bind(&CommIn::handle_receive_from, this,
>>         boost::asio::placeholders::error,
>>         boost::asio::placeholders::bytes_transferred));
>> I'm using Visual C++ 2005 Express, and a UML to C++ modeler and code
>> generator called Rhapsody.  I'm not sure where to even begin  
>> troubleshooting
>> this.
>
> Debug into it and see what pointer is null at that call, then find out
> where that pointer should be set and why it is not.
> _______________________________________________
> Boost-users mailing list
> Boost-users@...
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: Library failing

by Mathew Benson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've narrowed it down to something with those three attributes.  I thought they were static and maybe I couldn't access static attributes in a library.  I checked the boost source code and found that they are static.  Is there a constraint on using static attributes within libraries?  My current project only creates static libraries (.lib), though my next step is to try creating a .dll instead.

On Fri, Nov 6, 2009 at 10:56 PM, Mathew Benson <mathew.benson@...> wrote:
It took a while to figure out the parameters, but boost::bind, boost::asio::placeholders::bytes_transferred, and boost::asio::placeholders::error were all null.  I can't figure out what I d differently that it worked when is was combined but broke in a library.  How do I set these?  Is there a boost init call?

Sent from my iPhone


On Nov 6, 2009, at 7:44 PM, OvermindDL1 <overminddl1@...> wrote:

On Fri, Nov 6, 2009 at 3:08 PM, Mathew Benson <mathew.benson@...> wrote:
I wrote a utility to abstract sending a data buffer to a central server with
a single function call.  I verified it works, and then split out the
functionality into a library (.lib).  I tried using it in a test
application, but keep getting an "Access violation reading location
0x00000000" error.  It occurs in the call:
socket_.async_receive_from(
       boost::asio::buffer(data_, max_length), sender_endpoint_,
       boost::bind(&CommIn::handle_receive_from, this,
       boost::asio::placeholders::error,
       boost::asio::placeholders::bytes_transferred));
I'm using Visual C++ 2005 Express, and a UML to C++ modeler and code
generator called Rhapsody.  I'm not sure where to even begin troubleshooting
this.

Debug into it and see what pointer is null at that call, then find out
where that pointer should be set and why it is not.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: Library failing

by Igor R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> It took a while to figure out the parameters, but boost::bind, boost::asio::placeholders::bytes_transferred, and boost::asio::placeholders::error were all null.

These parameters are not pointers, how can they be null?
Try to step into async_receive_from(), theninto its implementation
etc., and see what happens there.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: Library failing

by Mathew Benson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Don't know.  I just mean when I try:

printf("%08x\n",&boost::asio::placeholders::error);

It prints 0.  This confirms the "Access violation" error that Visual C++ displays.  When I try compiling it as a monolithic build without libraries, it displays the expected address and does not crash.  

I already stepped into non-static functions and it works just fine.  Its just the static functions and attributes that fail.

On Sat, Nov 7, 2009 at 10:07 AM, Igor R <boost.lists@...> wrote:
> It took a while to figure out the parameters, but boost::bind, boost::asio::placeholders::bytes_transferred, and boost::asio::placeholders::error were all null.

These parameters are not pointers, how can they be null?
Try to step into async_receive_from(), theninto its implementation
etc., and see what happens there.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users