05-23-2012 10:21 AM - edited 05-23-2012 10:29 AM
Hello.
I've written my own DLL in C# for communication during production process.
But always if I want Labview to use this DLL the communication fails at the first step: Opening the com port.
So I removed all of my code and made only a small DLL which opens/closes the com port.
When I execute the command line tool which uses exactly the same dll as Labview, COM port opening is possible.
The com-port can be chosen by adding a Parameter like "COM1" to the .exe file.
The function inside the dll must be called like: communication.open("COM1") and returns a "true" in case of error.
It would be very nice if somebody could help me and find the error.
Best regards
chosn
Solved! Go to Solution.
05-23-2012 10:56 AM
LabVIEW has built-in serial port communication ability Instrument IO --> Serial. Why are you writing your own DLL to do this?
05-24-2012 01:54 AM - edited 05-24-2012 02:04 AM
Hi, because the functions in the DLL should be used later on different systems (with and without labview).
But normally should be a COM-Port access inside a DLL be possible in Labview?
Regards
05-24-2012 04:18 AM - edited 05-24-2012 04:23 AM
Hi again.
I changed my dll to output the Exception of my try-catch function during opening the port to a string.
System.Security.SecurityException: Fehler bei der Anforderung des Berechtigungstyps "System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". bei System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) bei System.Security.CodeAccessPermission.Demand() bei System.IO.Ports.SerialPort.Open() bei OpenComPortTest.communication.open(String port_selection) Die Aktion, bei der ein Fehler aufgetreten ist: Demand Der Typ der ersten Berechtigung, bei der ein Fehler aufgetreten ist: System.Security.Permissions.SecurityPermission Die Zone der Assembly, bei der ein Fehler aufgetreten ist: Intranet
The problem was, that the dll has been on a mapped Network drive.
After moving it to a local drive, it works.
Regards
chosn
05-24-2012 07:18 AM
@jfisch wrote:
Hi again.
I changed my dll to output the Exception of my try-catch function during opening the port to a string.
The problem was, that the dll has been on a mapped Network drive.After moving it to a local drive, it works.
This is a .NET security "feature".
12-05-2012 08:36 AM
Dear chosn,
I want to create a Serial port dll using visual C++,
and i want to use that dll in Lab view application.
Can you please help me to create Serial port dl..
thank you
Sunil