LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help with Preprocessor Definitions for Microsoft MT3620 RF DLL

Hello, I am trying to import a shared library for a Microsoft DLL for the MT3620 RF tools (this is an Azure Sphere chip Microsoft developed for IoT devices). When I load the library only a few of the over 50 functions can be wrappered. I get an error for the others that they have an undefined symbol. It looks like I need Preprocessor definitions but I am not sure how to reconcile, very limited experience with DLL's. Header file is attached.

 

CFEARING01_0-1686153199145.png

 

Chase Fearing
Test Engineer, Certified LabVIEW Architect
0 Kudos
Message 1 of 7
(1,245 Views)

It's most likely enough by replacing this definition in your header file:

struct Mt3620RfHandle;

with something like this instead:

typedef uintptr_t Mt3620RfHandle;

 

The original definition is an incomplete variable declaration. The C compiler can handle that as it is never really used, only a pointer to it. But the Import Library Wizard does want a full datatype.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 7
(1,231 Views)

Hey Rolf, thanks for your response!

 

You were correct that LabVIEW needed that typedef definition, I actually got help from a software developer on our team and he gave me this:

typedef struct Mt3620RfHandle Mt3620RfHandle;

It got me past the import errors, but LabVIEW created an empty typedef called Mt3620RfHandle.ctl which didn't work. When I tried your definition I am still getting the undefined symbols error on the import

Chase Fearing
Test Engineer, Certified LabVIEW Architect
0 Kudos
Message 3 of 7
(1,202 Views)

Well, I guess you will have to do some manual work.

 

Try this instead:

 

typedef uint64_t Mt3620RfHandle;

 

 

Leave the resulting control on the front panels a 64-bit integer but change in all Call Library Nodes its type to a Pointer Sized Unsigned Integer, passed by Value, not Pointer to Value!

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 7
(1,187 Views)

I am able to get the header file to import when I use this statement

typedef unsigned int Mt3620RfHandle;

From there, I believe I understand what you are saying

CFEARING01_0-1686166745820.png

But unsure how the Mt3620RfHandle is propagated from the mt3620Rf_create() function to subsequent calls that require the handle

Chase Fearing
Test Engineer, Certified LabVIEW Architect
0 Kudos
Message 5 of 7
(1,173 Views)

Problem is that you want the pointer as value in all calls, not the value the pointer is pointing at.

 

Maybe if you try:

 

typedef void * Mt3620RfHandle;

 

 

But then you would have to remove at all functions the asterisk after the MT3620RfHandle.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 7
(1,165 Views)

Hey Rolf,

 

Really appreciate the lengths to which you've been able to support. Unfortunately I am still hung up on reconciling how the C code works with LabVIEW dataflow and I am getting 1097 error on the Call Library Function Node. I'm an EE who doesn't know any software outside of LabVIEW...

 

Do you offer any consulting services? Reach out if this is something we could partner on - chase.fearing@subzero.com

Chase Fearing
Test Engineer, Certified LabVIEW Architect
0 Kudos
Message 7 of 7
(1,112 Views)