Jump to content

Question


Recommended Posts

That's because the GenericDeviceInterface.h doesn't declare the functions. And the other two DEMO header files don't really do either but are rather header files for an application to use this DLL with (and declare C++ classes, which the Import Library Wizard can't do anything with).

There are some function pointer declarations in GenericDevice_DLL_DEMODlg.h that the according sample code most likely dynamically imports from the DLL on initialization but the naming is only partly similar to the function names the DLL seems to export, so it is a bit tricky and there is no function pointer declaration for the GetRequestKey() export but two function pointers for a DLL_TEST and DLL_ShowData function that the DLL doesn't seem to export anything similar for.

Link to comment
2 hours ago, New said:

Thank you Mr. Kalbermatter!

Do you have any suggestionson on how to solve the issue? I don't want to change anything in the files themself. Do I have to write another header file, in which I connect the functions which are named similar? (Never programmed before, so I actually have no idea if this would be even possible )

Well, if you have the source code for the GenericDevice_DLL_DEMODlg program you may be able to verify that which function pointer is assigned which DLL function. Without that it is simply assuming and things and there is "ass" in the word assuming, which is where assumptions usually bite you in! 😀

  • Haha 1
Link to comment
27 minutes ago, New said:

I found this code (attached below). In row 222 I found the following function:

StartGenericDevice                = (DLL_START) GetProcAddress( m_hDLL, "StartGenericDevice" );   

I wrote it into the space for Preprocessor Definition to see if LabView would find the function (StartGenericDevide), however I got the same answer as the first time (see first question with the attached picture).

Do I have to write those functions in another file? header file? Should I connect it to the other header files?

Preprocessor Definitions.JPG

GENERICDEVICE_DLL_DEMODlg.cpp 18.71 kB · 0 downloads

You really should learn a little C programming. Because that is what is required when trying to call DLLs. Or hire someone to make the LabVIEW bindings for you!

Currently you are sticking around with a pole in a heap of hay to find the needles hidden in there, but having chosen to not only blindfold yourself to make it more "interesting" but also bind your hands on your back.

DLL_START is the function pointer declaration and is basically documenting the parameters and return value the function takes. This is almost what you need to use for the import library wizard but not quite. A function pointer declaration is only similar to a function declaration but not the same. The Import Library Wizard however needs a function declaration and it needs to use the same name as what the DLL is exporting, otherwise the wizard can't match the declaration to a particular function.

In your example you need to find what function pointer declaration is used for which function. Then you need to translate it to a function declaration. So you have determined that the DLL_START declaration is used for the function pointer for StartGenericDevice()

typedef int					(*DLL_START) ( DWORD *dwSamplerate );

will then have to be turned into following function declaration:

int StartGenericDevice( DWORD *dwSamplerate );

With this the Import Library Wizard does have a function prototype to use for the function exported from the DLL.

Now you need to do that also for your other functions in the DLL.

 

Link to comment
  • New changed the title to Question

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
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.