Jump to content

Help me parse this overcomplicated dll (pcProxAPI)


Recommended Posts

Posted (edited)

I don't think I can attach the .dll itself since it isn't my code, but I think I can reasonably share the relevant snippets.

First, I'd like to clarify that the manufacturer provided example code in Python, which works fine. 

I've tried this both using the wizard, and Call Library Function Nodes. I must say, I don't really understand the wizard at all, as it seems to make no attempt to actually parse the provided .h file (it complains about missing preprocessor definitions, which as far as I can tell are already in the .h file, and it complains about e.g. windows.h not being found, even when I explicitly add its complete path to the "Include Paths" section).

Tbh I'm not remotely sure what, if anything, I need to add to includes and preprocessor definitions. 

Using the Function Node, LabVIEW immediately crashes, despite my attempt to follow the examples (see my .vi).

Here's the key call which works in Python:

pcproxlib.usbConnect.restype = ctypes.c_short
rc = pcproxlib.usbConnect()
if rc == 1:
	rawData = ""
    buffer_size = ctypes.c_short(32)
    pcproxlib.GetActiveID32.restype = ctypes.c_short
    # create a buffer of given size to pass it
    # to get the raw data.
    raw_data_tmp = (ctypes.c_ubyte * buffer_size.value)()
    #as per documentation 250 millisecond sleep is required
    # to get the raw data.
    time.sleep(250/1000.0)
    nbBits = pcproxlib.GetActiveID32(raw_data_tmp , buffer_size)
pcproxlib.USBDisconnect.restype = ctypes.c_short
pcproxlib.USBDisconnect()

I've attached the .h file, and the .vi file of my failed attempt at using the Function Node. 

How on earth is one supposed to figure all this out de novo?

pcProxAPI.h pcProxAPI test.vi

Edited by meubanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.