NullReferenceException: Object reference not set to an instance of an object

Discussion in 'ASP .Net' started by Rob Van Zant, Nov 10, 2003.

  1. Rob Van Zant

    Rob Van Zant Guest

    I have a 3rd party library (.lib) file with two header files which I have
    wrapped in a c++ .net dll. I am trying to use that dll in an asp.net
    project but I get the error "Object reference not set to an instance of an
    object."

    I added the dll to my project as a .net reference and I can see all exposed
    functions in the object browser. The function call(s) that causes the error
    is

    sweep_output_t* sweep_output = new sweep_output_t[sizof_series];
    [sweep_output=(sweep_output_t *)malloc(sizeof(sweep_output_t)*sizof_series);
    gives the same error.]

    sweep_output_t is a structure defined in one of the third party header files
    and sizof_series is an integer that in my test is set to 3. I don't know if
    it matters but I can not see sweep_output_t in the object browser but I can
    see sweep_output_s.

    typedef struct sweep_output_s
    {
    double f;
    double il;
    double rl;
    double ph;
    double gd;
    } sweep_output_t;

    I checked to make sure my dll is working correctly by changing the project
    to build an executable and adding a windows form and the lib file and
    wrapper code work great.

    The stack trace reveals "new(UInt32 ) +0" [or "malloc(UInt32 ) +0" for
    malloc alternative].

    Any help in resolving my problem will be greatly appreciated.

    Thanks,
    Rob
    Rob Van Zant, Nov 10, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Angel Faus
    Replies:
    2
    Views:
    978
    Jeff Washburn
    Dec 1, 2003
  2. PatricQ
    Replies:
    3
    Views:
    9,542
    PatricQ
    Feb 18, 2004
  3. Adam Knight
    Replies:
    1
    Views:
    2,910
    =?Utf-8?B?RFdT?=
    Feb 9, 2006
  4. John Smith
    Replies:
    13
    Views:
    7,459
    Bob Barrows [MVP]
    Jun 6, 2006
  5. kuvpatel
    Replies:
    1
    Views:
    391
    Victor Garcia Aprea [MVP]
    Oct 25, 2003
Loading...

Share This Page