06-07-2023 10:54 AM
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.
06-07-2023 11:18 AM
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.
06-07-2023 01:07 PM
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
06-07-2023 02:11 PM - edited 06-07-2023 02:19 PM
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!
06-07-2023 02:40 PM
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
But unsure how the Mt3620RfHandle is propagated from the mt3620Rf_create() function to subsequent calls that require the handle
06-07-2023 03:15 PM - edited 06-07-2023 03:17 PM
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.
06-08-2023 10:45 AM
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