I have a specific USB device that has it's own driver for Win7.
It works fine in my .NET application, I'm using drivers functions (C++) to manipulate device.
Now I'm trying to get this device work in LabVIEW.
Is there a way to somehow adapt existing driver for it? Or it is useless and I need to write completely new driver for LabVIEW?
For now I created a driver using "NI-VISA Driver Wizard" so that "NI MAX" and "NI-VISA Interactive Control" detect my device. But I don't know what to do next?
Compile the driver C source files as a dll.
https://forums.ni.com/t5/Measurement-Studio-for-VC/How-to-create-a-DLL-file-from-a-C-file/td-p/866863
Then import the dll into LabVIEW.
http://digital.ni.com/public.nsf/allkb/DCB90714981A1F148625731E00797C33
As highlighted by Prain, the following is an example describing how C/ dll can be used in LabVIEW
https://forums.ni.com/t5/Example-Program-Drafts/Using-Existing-C-Code-or-a-DLL-in-LabVIEW/ta-p/3499233
Related
I have an application I developed for PC using the TsqlConnection Component The driver is set to MySQL and runs great when the driver dll's are present. I wanted to make a client for Android Using Delphi XE5. I again used TsqlConnection and when I select mySql for the Driver property it adds Data.DBXMySQL To my USES section but the compiler tells me "Cannot Resolve Unit Name"... Is this .pas not in delphi's library, or am I missing something else? Also I'm fairly certain that I'll need some kind of lib file like the DLL's I used in my pc application. Please do not suggest I use another component (that won't solve my issue or better my understanding) thanks!
I am trying to port an unmanaged C++ Dll from one embedded device to another and am facing some strange problems which I think must have something to do with memorymanagement and/or compilers. I am not posting much code but describe what I tried as I have tried too many different things to post all code and I think the problem must be somewhere deeper within.
The first device is running WinCE 5.0 and is compiled using embedded Visual C++ 4.0.
The second device is running Windows Embedded Compact 7 (I will call it WinCE 7 for simplicity) and is compiled using VS2008. Both devices have their own SDKs designed for the boards.
On the first device the Dll is running without any problems, but on the second device the with ne new SDK compiled Dll is not working. Having a C# applikation on the second device I tryed PInvoke to access the dll but on the PInvoke line in Debug Mode got the error message:
Can't find PInvoke DLL NAME.dll
After some research I learnd this error can have differend causes:
Missing dependencies of the native library you are calling into.
The native assmebly was compiled for the wrong subsystem (i.e. desktop, not CE)
The native assembly was compiled for the wrong processor (i.e. x86 and not ARM)
Not enough virtual memory for the DLL to load.
I used peinfo to check the dll. All dependencies are being found on the device, it is compiled for WinCE 7 and the processor type is right. (I would have been surprised if not, using the right SDK) So there still is number 4: not enough virtual memory. But WinCE5 is limited to 32MB virtual memory and running while WinCE7 can have up to 2GB?
So I started to try some things to narrow the error in and will tell you my results.
First I took my dll compiled for the first device and tryed to use it on the second device. Surprisingly the .net application can find and PInvoke this one. But some functions inside the Dll don't seem to be running right so I guess I have to use the right SDK. But having the right code for both dll I know the exports must be right. I am aware the two compilers use different c++ name mangling styles so that is not the problem, too.
Next I wrote a simple c++ application on VS2008 using the new SDK to Load the Dll from there. On the first device the application runs this way but now on my remote Display on running on the second device I get the Error Message:
Unable to import library NAME.dll ! Program will exit.
At least now I know it has nothing to do with .net and PInvoke. But further on I made a simple new dll using VS2008 and the new SDK and ne .net application is able to PInvoke it. So there must be something in the code that doesn't like to be Loaded. :-/
After some hours of searching through the code I realised the system doesn't like some global variables. I know global variables are bad and I would be glad if they wouldn't be there, but I have not started the code and over the years they got more and more before me dealing with it, so they would be very hard to erase right now.
These globals are instances of classes. Some of them seem to be bad, some others seem to be ok. Confusingly they all are instances of classes and I don't know why there are good and bad ones. When I comment out the bad globals, the application is able to PInvoke the Dll. One of the bad globals is enough to make to applikation not find the Dll.
Why is it like this using VS2008 with WinCE 7 but not using eVC4.0 with WinCE 5? And what is the problem with the globals? How can I solve this problem? At best the same code should be working for both compilers but first I need some ideas, what is wrong with the second compiler.
I have found the solution to my Dll loading problem. The two systems have a different behaviour on #pragma pack. So eventually there was missalignment while loading the dll what made the dll crash. Because of the globals it was in the loading process of the dll, so the error message did not say something about missalignment but the standard "Can't find PInvoke DLL".
I'm a bit confused on something, being quite a while since I've used external controls. Basically, I'm writing a small test app with Delphi XE3 which uses an ActiveX control. A TLB file is generated as usual. I have tested on two machines (an Acer notebook and a Dell Latitude 10). When I test on my desktop Windows machine I get an error traceable to the OCX file. I was under the impression that the TLB.pas file was all that was needed to instantiate the control. Do I also need to install and register the OCX file ? Does COM component need to be distributed with its .DLL file ? TIA for your anticipated help.
Brian Corll
The type library only describes how to call the library. The .pas file generated from the type library also only describes how to call the library. That's all compile time. At run time when you actually call the library, you need the library to be registered and present.
So yes, you'll need to distribute and register the library.
I'm using ACOS3X smart cards in my Delphi application for user authentication. Everything is fine in Windows XP, but in Windows 7, every time I put the card into the reader (which is ACR38-CCID), windows tries to install a driver for it, to no avail. This does not affect my application in any way, but it's really annoying. Should I write a driver for my card just to satisfy Windows 7? And, if yes, could someone please tell me if it's possible to create drivers with Delphi?
This is what Windows 7 (and IIRC also Vista) does. If you insert a smart card, it tries to locate a minidriver through Windows Update.
Not sure if it works, but you can maybe modify Windows registry to include the necessary entry for your card (but not point to a working implementation).
Look into Windows Minidriver Specification (available from MS) and the "discovery" section in that document.
I'm a windows developer looking for implementation of priting support for Windows Mobile 6.5.
As the WM6.5 is based on the Windows CE 5.0, I have gone through the architecture of Printing in Windows CE and what I have realized from the Windows CE Printer architecture is :
For a USB class printer the main components required for printing in Windows CE apart from Display driver and GDI components would be :
Printer driver : PCL.dll
The underliying port driver for USB class driver : USBPRN.dll
These components' source code exist in the driver samples provided by the WinCE 5.0 platform builder.
Though these components exist no third parties (ex: PrintBoy,PrintCE ) seems to be utilising them.
My Queries are:
1.Can I use the Microsoft supplied source code of these compenents as it is to support Printing in Windows Mobile?
2.According to Microsoft's Shared source License agreement,are there any source code usage viaolation if I use them?
3.Can I use the source code of PCL and USBPRN to support in Windows Mobile as it is? or do I need to modify it?
(I assume Windows Mobile have GDI and Display driver components by default.)
Thanks.
Sree.
I Don't believe WinMo includes the printer pieces for CE.
I'm not a lawyer (nor do I play one on TV) but my interpretation is that you can't take the pieces from Platform Builder and use them in your WinMo OS. You are licensed to modify them if you need and use them in your own custom OS.
See #2. PCL would probably work as-is, but I'm guessing the USB printer driver might need at least some configuration work for your platform.