LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call Library Function Node question

General question,

I have a .dll function prototype that is:
SFCDLL_API long int __stdcall InitializePort(long int portnumber, SCC_REGS *registers)

and SCC_REGS *registers is defined as:
typedef struct
{
long cmdr; //expects hex value for the 32-bit registers (0x0000FFFF for example)
long star;
long ccr0;
long ccr1;
}SCC_REGS

My question is when I create the second argument in the Call Library Function Node configuration, what do I need to specify in "Type" and "Data Type?" Thanks!!
0 Kudos
Message 1 of 3
(2,562 Views)


@NCLS wrote:
General question,

I have a .dll function prototype that is:
SFCDLL_API long int __stdcall InitializePort(long int portnumber, SCC_REGS *registers)

and SCC_REGS *registers is defined as:
typedef struct
{
long cmdr; //expects hex value for the 32-bit registers (0x0000FFFF for example)
long star;
long ccr0;
long ccr1;
}SCC_REGS

My question is when I create the second argument in the Call Library Function Node configuration, what do I need to specify in "Type" and "Data Type?" Thanks!!




Basically create a cluster in your application containing four 32 bit integers named cmdr, star, ccr0, ccr1 and make sure they have this same cluster order. Then in the Call Library Node configure this parameter to "Adapt to Type". The second one "Handles by Value" or "Handles by Pointer" has no meaning for this type so just leave it in its default.

Now if you crash, you may want to check the "Calling convention" setting. Your function prototype uses its own function API declaration SFCDLL_API, so it is hard to see if that means stdcall or cdecl (among other things probably) without seeing the entire header file for your DLL.

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(2,548 Views)
Thanks, I will play around with it.
0 Kudos
Message 3 of 3
(2,539 Views)