• 0

vb.net and/or c#.net wrapper for dwf.dll


Just downloaded Waveforms and would like to use the dwf.dll in a vb.net program. When trying to include the dll as a reference I get an error that it is not recognized as a valid COM component or assembly.

Do you have a compatible wrapper or other suggestion?


Regards mijq

Share this post

Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 1

Hello, mijq

I created a wrapper that can be called from VB6 by modifying __stdcall calling convention and DEF file.

Readme.txt is written in Japanese, sorry.
To use it, copy the wrapper [digilent.dll] to the [%windir%/system32] folder



Share this post

Link to post
Share on other sites
  • 0

Thanks, but it does not bring me any further. I use vb.net and not vb 6.0. 

Do you have any example code where the c++ functions are imported into a vb.net or c#.net program?

Share this post

Link to post
Share on other sites
  • 0

Got a little further:

Imports System.Runtime.InteropServices

Public Class frmMain
    Public Shared Function FDwfDeviceOpen(ByVal idxDevice As Integer, ByRef phdwf As IntPtr) As Integer
    End Function
    Dim hdwf As IntPtr
    Private Sub frmMain_Load(sender As Object, e As System.EventArgs) Handles Me.Load
            FDwfDeviceOpen(-1, hdwf)
        Catch ex As Exception
        End Try

    End Sub
End Class


It seems that the <DllImport..> works, but the program throws an exception: 

A call to PInvoke function 'testAnalogDiscovery2!testAnalogDiscovery2.frmMain::FDwfDeviceOpen' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.


Please advise

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now