[C++-sig] vc++ assertion error upon runtime

hitesh dhiman hitesh.dhiman.1988 at gmail.com
Mon Mar 22 09:56:29 CET 2010


Hey Jim
I found out where the problem was.
This function is actually reading out null values, hence the error. There
was a problem in the execution of the code before it. I was able to solve it
by commenting out this part and print out the values step by step. One of
the dll's being used was not registered, and so CoCreateInstance was giving
out a -ve value on loading the dll, and this function was accessing vectors
that were not initialized by the previous function.

Thanks for the help!

On Mon, Mar 22, 2010 at 10:44 AM, Jim Bosch <talljimbo at gmail.com> wrote:

> On Fri, 2010-03-19 at 14:45 +0800, hitesh dhiman wrote:
> >         > Hi all,
> >         > I'm  trying to gain access to functions that use pointers as
> >         > arguments. I have written the wrapper file that converts the
> >         arguments
> >         > into pointers. The compilation works successfully, but when
> >         i try to
> >         > run the code from python, it gives an assertion error:
> >         > Debug Assertion Failed!
> >         > Expression: Vector subscript out of range
> >
> On Mon, 2010-03-22 at 09:44 +0800, hitesh dhiman wrote:
> > Hi Jim,
> > Well, the code's rather official, so i won't be able to give the exact
> > details, but here's the code simplified:
> >
> >
> > CFunctionRequest( pData, (DWORD*)&ucmmReq.len)
> >  where pData is BYTE    pData[512];
> > and
> >  typedef struct
> > {
> > int len;
> > char* data;
> > } Data;
> > with Data    ucmmReq
> >
> >
> > The definition for the CFunctionRequest is CFunctionRequest(BYTE*
> > pRequest, DWORD* pLength)
> > This is where the problem occurs. Above this, it works fine.
> > Do let me know if some more info is needed.
> > Thanks.
> >
>
> Do you think this "debug assertion" is happening in Boost.Python code
> somewhere?  I assume it's somewhere in the code you are wrapping.
>
> I also can't help but notice that your C functions seem to take arrays,
> not pointers to scalar values, and that leaves me rather confused as to
> what type of Python object you could be taking as input and converting
> into an array.
>
> Jim
>
>
>
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>



-- 
Regards,
Hitesh Dhiman
Electrical Engineering
National University of Singapore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20100322/655adc94/attachment.html>


More information about the Cplusplus-sig mailing list