Jump to content

Call Library Function


Recommended Posts

I have the following c function:

extern "C"{

int getInterfaces( uint32_t numInterface, void* g_hSystem);
    
}

int getInterfaces( uint32_t numInterface, void* g_hSystem)
{
    //Get Interface
    bool bChanged = false;

    SV_RETURN ret = SVSystemUpdateInterfaceList(g_hSystem, &bChanged, 1000);
    if (SV_ERROR_SUCCESS != ret)
    {
        printf("%s SVSystemUpdateInterfaceList failed!:%d\n", __FUNCTION__, ret);
        return -1;
    }

    ret = SVSystemGetNumInterfaces(g_hSystem, &numInterface);
    if (SV_ERROR_SUCCESS != ret)
    {
        printf("%s SVSystemGetNumInterfaces failed!:%d\n", __FUNCTION__, ret);
        return -1;
    }

    if (0 == numInterface)
    {
        printf("%s No Interface Available!\n", __FUNCTION__);
        return -1;
    }
}

 

How would I create "void* g_hSystem" in Labview?

 

 

 

 

 

Link to comment
  • 1 month later...

It misses context. void means NOTHING, and void * means a pointer to whatever the C programmer may have decided. Problem is that if the caller and callee don't agree what that anything means, really BAD things will happen. But without some more information all I can say is that it is a pointer and that would be in the LabVIEW Call Library Node a pointer sized integer. If that could work in this context is at least questionably. There obviously would need to be some other function that can return such a "handle"to you. The functions as you show them only consume this handle and can't create it in a meaningful way.

Link to comment

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.