02-26-2010 12:59 PM
I've been trying to call this Driver DLL with a C# app and I'm just not having very much luck.
First I tried the way I normally call DLLs with [DLLimport]. This did not work, as the DLL has no entry points. Here's the Dumpbin /exports for the DLL:
D:\DLL>dumpbin /exports DriverMgr2.dll
Microsoft (R) COFF/PE Dumper Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file DriverMgr2.dll
File Type: DLL
Section contains the following exports for DriverMgr.DLL
460AA39C time date stamp Wed Mar 28 11:19:24 2007
1 ordinal base
4 number of functions
4 number of names
ordinal hint RVA name
1 0 000010C4 DllCanUnloadNow
2 1 00001114 DllGetClassObject
3 2 00001131 DllRegisterServer
4 3 00001144 DllUnregisterServer
None of the functions like "OpenDevice" are there, and I can't figure out how to modify the DLL source to make the regular functions appear as entry points, but the DLL uses a format I'm unfamiliar with.
So then I tried just added the DLL as a resource in my C# application. It created the interop DLL and I could call that just fine. The problem is that it didn't include any pointers in the function parameters...they are just missing. So instead of OpenDevice(long *status), it's just OpenDevice().
I've been trying to find a way to fix this for way to long. There has to be a better way, and someone has to have done this before. The VB GUI example seems to just import the DLL and everything works fine. Why am I having so much trouble with this?
Any and all help is appriciated!
03-19-2010 08:10 AM
03-23-2010 12:51 PM
Interesting. Are you using Visual Studio 2005 to edit DriverMgr? I am trying to start out with some small changes to DriverMgr (in s3_1000.cpp), but I am having a real problem getting the new DriverMgr2.dll I generate to work with their existing app. I thought it was because I have to upgrade their project files from Visual Studio 6 to 2005, and then all their dependencies were messed up. So I opened up a VS 2005 Command Prompt and just ran their DriverMgr.mak file, creating a new DriverMgr2.dll in the ReleaseMinDependency folder. In the setup.exe CAB file, I replaced the original DriverMgr2.dll with my slightly altered one, and edited the Setup.lst file to reflect the new timestamp. Then I try to re-install the PCIe Demo, but it always get a "Failed to register DriverMgr2.dll" error.
I'm kind of new to working with DLL's -- how are you changing and using your newly generated DriverMgr2.dll (if that's even what you're doing!) ?
Thanks a lot,
03-24-2010 12:09 PM
I'm using visual studio 2009, and I'm not cmopiling the original drivermgr, I am creating a new project, copying in the functions, and changing parameters and data structures and functions that require a lot of dependencies. Then I am setting up the DLL the way that works for everything, using extern "C" and __declspec(dllexport). I wish the original drivermgr worked like that.
I was able to get DriverMgr to compile...but I don't remember what I did, and it didn't actually help me at all.
There might be an easier way to implement DriverMgr in C# but I could not find it. I'm still a bit puzzled as to how they got their visual basic example working (but I don't really know visual basic).
11-24-2010 11:16 PM
I also have a similar problem. I tried opening the sample VB application(.vbp) in VS2008, which asked for upgrade to open. After upgrading the project interop dlls were created for DriverMgr and .vbproj file is created.
I could build the application and upon running resulted in Error at StartDMA() function stating Exception read or write access violation. Is there any resolution to this problem.
Thanks in advance.
02-23-2011 09:33 PM
I think this is not a FPGA question anymore, but more a driver one. This forum board might not be the best place for this kind of questions. Perhpas it would better be asked in other OS forums.