For Programmers: Free Programming Magazines  


Home > Archive > C# > December 2005 > C++ function call with C#









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author C++ function call with C#
AlMan42

2005-12-12, 9:12 am

Newbie question.

I'm trying to call the following function defined in a .dll

BOOL OfflineSDK_IsMediaAvailable(BOOL* pbMediaReady)

I've set up the [DLLImport] stuff and it works fine for other methods I'm calling in the DLL. I try to call the function but am getting System.NullReferenceException: Object reference not set to an instance of an object.

[DllImport("OffLineSDK.dll", CharSet=CharSet.Auto, EntryPoint="? OffLineSDK_IsMediaAvailable@@YAHU_DEVICE
@@PAH@Z")]
private static extern bool ProDVD_OffLineSDK_IsMediaAvailable(ref bool available);

Code in calling method....
{
bool available = new bool();
OfflineSDK_IsMediaAvailable(ref available);
}

Any ideas?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com