-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: PKiran1981
Message 1 in Discussion
hi, I have a win32api DLL having some classes in it. i would like to use the
classes of the DLL in my C# class using the [DllImport("dllname",entrypoint="#3")]
statement. I have some functions in the DLL which will return me objects of the
classes present within the DLL. In C#, I am using an IntPtr to store the returned
objects and am trying to call the functions of the object using one more DllImport
statement, for redeclaring the function, with the first argument as an IntPtr which is
got by the previous function. But I am getting a NullReferenceException. Code:
DLL(SomeDLL.dll) class SomeClass{ public: int
someFunction(){.......} } class __declspec(dllexport) ClassFactory{
void* createInstance(){ SomeClass* obj=new SomeClass();
return obj; } //similarly there is a
deleteInstance function } C# class CSClass {
[DllImport("SomeDll.dll",EntryPoint="?................?")] public static
extern IntPtr createInstance();
[DllImport("SomeDll.dll",EntryPoint="?................?")] public static
extern int someFunction(IntPtr obj); static void main(string[] args)
{ IntPtr obj=createInstance(); int a=someFunction(obj);
} } I am getting the following exception: Unhandled Exception:
System.NullReferenceException: Object reference not set to
an instance of an object. Please tell me what is wrong with the above code
Regards kiran
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]