konimarti / opc

OPC DA client in Golang for monitoring and analyzing process data based on Windows COM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation finished with exit code 2

Nick-Su opened this issue · comments

commented

Hello! I have a problem with compilation. It says "Compilation finished with exit code 2" (I use windows 7 x64). Could you explan, how can I solve this problem and where can I get the "OPC DA Automation Wrapper 2.02" and "ÒPCDAAuto.dll" and in which folder should I extract them?

6vcn6ehu5-q

Hi! You can compile the code when you set the $GOARCH environment variable to "386". In Powershell on Windows, you enter the following $ENV:GOARCH=386 then it should compile. Note, however, that without the OPCDAAuto.dll you won't be able to use this package. You normally get the DLL with the installation of your OPC server or from the vendor of your OPC server directly and it's either installed on C:\Windows\System32 or C:\Windows\SysWOW64. Hope this answers your questions.

You can download the Graybox DA Automation wrapper for free here.
I have updated the code base so that it works with this wrapper as well, just do a go get -u github.com/konimarti/opc to get the newest version. However, it is important to keep in mind to use the correct architecture as well, i.e. when you use the Graybox Simulation server set the architecture to 32-bit: $GOARCH=386.

commented

Thank you for fast response! Your advice helped me a lot, but I faced with another problem. When I run the program for the first time it returns "exit code 0". When I run the program for the second time it returns nothing and I have to reboot the PC. Any comment will be appreciated.

sk-4yoxmipg
lrtomnk5tds

An exit code 0 indicates that the program terminated correctly. I have never experienced the other behavior you have described though. Do you observe the same when you run the code directly from the command line, i.e. in Powershell?
What you can try is to add opc.Debug() before the opc.NewConnection call to print out some more package-related information. Also, is the Graybox Simulation server running? You can check this by looking for gb_opcsim.exe in the task manager.

Just wanted to check in and ask if you could solve your issue?

commented

Now it works well. The problem is solved. Thanks for asking. Thread can be closed.