Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

NullReferenceException in calling C native method

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Brun - 24 Feb 2004 16:16 GMT
Hi guys,

I get the following error during runtime:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at SXInit(Int32 )

The SXInit method is a native C function I am calling from Managed C++ and the method is expecting a number of integers as
parameters and the constants I am passing have been defined in the C library as "#define xxxx 2100".

My questions are:

       1) Why do I see Int32 there?

       2) Are the "#define" statements converting themselves to Int32s?

I would appreciate if there is a way around calling C functions and passing them "int" according to the native data type definition
and not Int32 which is a C++ Managed Type since Int32 is an object.

Please let me know

Thanks
Paul
Paul Brun - 24 Feb 2004 19:36 GMT
just to clarify, this is the runtime definition in my "C" library header:

extern int SXInit (int, ...);

Paul

 Hi guys,

 I get the following error during runtime:

 Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
 at SXInit(Int32 )

 The SXInit method is a native C function I am calling from Managed C++ and the method is expecting a number of integers as
 parameters and the constants I am passing have been defined in the C library as "#define xxxx 2100".

 My questions are:

         1) Why do I see Int32 there?

         2) Are the "#define" statements converting themselves to Int32s?

 I would appreciate if there is a way around calling C functions and passing them "int" according to the native data type definition
 and not Int32 which is a C++ Managed Type since Int32 is an object.

 Please let me know

 Thanks
 Paul
Peter Obel - 03 Mar 2005 23:43 GMT
Paul

Did you ever find the solution, as I am having this problem right now.

Regards

Peter

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.