UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor mdye
Visitor
9,786 Views
Registered: ‎01-18-2010

Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

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

 

    00000000 characteristics

    460AA39C time date stamp Wed Mar 28 11:19:24 2007

        0.00 version

           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

 

  Summary

 

        3000 .data

        3000 .rdata

        1000 .reloc

        2000 .rsrc

        D000 .text

 

 

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! 

0 Kudos
8 Replies
Visitor charlie5360
Visitor
9,714 Views
Registered: ‎02-24-2010

Re: Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

I am having the exact same problem!  Does anyone know the best way to use XAPP1052 DriverMgr functions within C#?

0 Kudos
Visitor mdye
Visitor
9,703 Views
Registered: ‎01-18-2010

Re: Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

I ended up giving up trying to get it implemented in C# after spending wayyy too long trying to get it working. I'm currently re-writing DriverMgr so that it can be imported easily by c# (which means just using extern "C" with all the functions and using plain types). It's kind of a pain though since I'm having to go through and modify a bunch of stuff.
0 Kudos
Visitor charlie5360
Visitor
9,680 Views
Registered: ‎02-24-2010

Re: Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

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,

Charlie

0 Kudos
Visitor mdye
Visitor
9,669 Views
Registered: ‎01-18-2010

Re: Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

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).

0 Kudos
Adventurer
Adventurer
9,077 Views
Registered: ‎08-05-2010

Re: Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

did anyone figure out how to import this dll into csharp? I am having the same issue

0 Kudos
Visitor murali1010
Visitor
8,595 Views
Registered: ‎10-19-2010

Re: Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

Hi..

 

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.

 

 

 

0 Kudos
Highlighted
Explorer
Explorer
8,290 Views
Registered: ‎10-01-2008

Re: Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

Hi All,

 

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.

 

0 Kudos
Contributor
Contributor
4,092 Views
Registered: ‎04-26-2012

Re: Xapp1052 Can't call DriverMgr DLL functions correctly with CSharp

the argument  statues in OpenDevice(long *status) acts like a returned value in Visual basic and i think its the same on C#.

this argument is defined as [output] in DriveMgr.idl and hence it'll be like function OpenDevice() as long in VB.

status is the returned value of the function in VB. if you remove the long *status argument then you will see that the function OpenDevice() changes to Sub OpenDevice().

____________________

 

 

 

 

0 Kudos