Jump to content

LIN dll


Recommended Posts

http://forums.lavag.org/index.php?act=attach&type=post&id=6328

Hello,

I am trying to access function "xlLinSetChannelParams" from vxlapi.dll (see the attached archive). For the parameter "statPar" I need to pass a structure and I use a cluster with the format specified in the function prototype. If Adapt to Type is selected as input type, there are to possibilities to pass data: by value and by pointer. No matter what data format I choose, the function prototype shows me that data will be passed by pointer (short int _xlLinSetChannelParams@28(long portHandle, unsigned long long accessMask, void *LinParam);).

Any idea how to fix this or use other method to make this function work.

P.S. If you manage to make this work, you will receive an error code with values between 0 and 255. The inputs portHandle and accessMask are correct; the problem comes from the structure.

Link to comment

Well, I was using the current beta version, so it's possible that this was a bug which was fixed. I suggest you try asking NI support directly.

P.S. Does it crash immediately after you call this?

How do you know the structure is to blame?

Link to comment

QUOTE(polyplay @ Jul 9 2007, 04:11 AM)

http://forums.lavag.org/index.php?act=attach&type=post&id=6328''>http://forums.lavag.org/index.php?act=attach&type=post&id=6328'>http://forums.lavag.org/index.php?act=attach&type=post&id=6328

Hello,

I am trying to access function "xlLinSetChannelParams" from vxlapi.dll (see the attached archive). For the parameter "statPar" I need to pass a structure and I use a cluster with the format specified in the function prototype. If Adapt to Type is selected as input type, there are to possibilities to pass data: by value and by pointer. No matter what data format I choose, the function prototype shows me that data will be passed by pointer (short int _xlLinSetChannelParams@28(long portHandle, unsigned long long accessMask, void *LinParam);).

Any idea how to fix this or use other method to make this function work.

P.S. If you manage to make this work, you will receive an error code with values between 0 and 255. The inputs portHandle and accessMask are correct; the problem comes from the structure.

If your actual C code header file is really as you show in your text file you might have a serious problem here.

typedef struct {

unsigned int LINMode;

int baud rate; < this is definitely not valid C syntax.

unsigned int LINVersion;

unsigned int reserved;

} XLlinStatPar;

XLstatus xlLinSetChannelParams (XLportHandle portHandle, XLaccess accessMask, XLlinStatPar statPar);

What LabVIEW will assume for structure parameters is:

XLstatus xlLinSetChannelParams (XLportHandle portHandle, XLaccess accessMask, XLlinStatPar *statPar);

passing the structure by pointer. I'm not aware that this can be done otherwise so maybe the C compiler will automatically make this parameter passed by pointer but that is beyond my C detail knowledge.

Rolf Kalbermatter

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.