I get an Exception when use RCFProto

RCFProto support and general discussion.
Post Reply
mooninsum
Posts: 4
Joined: Mon Sep 23, 2013 1:39 pm

I get an Exception when use RCFProto

Post by mooninsum »

I want to use RCFProto to connect C# and Python Application. When run the Tutorial (http://www.deltavsoft.com/RCFProto/doc/ ... orial.html), I get an Exception: Unable to load RCFProto native bindings for .NET. Attempted to load: RCFProto_NET_impl.dll.
LoadLibraryEx() error: %1 Is not a valid Win32 Application.
I run it in Win7 x64, and I copy x64/RCFProto_NET_impl.dll to my project.

And if I use x86/RCFProto_NET_impl.dll in my project. It say that I miss MSVCP110.dll

How can I fix it?

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: I get an Exception when use RCFProto

Post by jarl »

Your C# program is most likely running as an x86 process, which is why it refuses to load the x64 DLL and instead tries to load the x86 DLL.

In the Visual Studio properties for your project, under the "Build" tab, there is a "Prefer 32-bit" option. If this option is checked, your program will be loaded as a 32-bit x86 process. You want to make sure that this option is unchecked, so that the program runs as a 64 bit process.

You can check at runtime if your program is running as 32 or 64 bit, by opening the Windows Task Manager and seeing if the program name has a "*32" next to it.

The error you get when you try to load the x86 DLL (missing MSVCP110.DLL) indicates that the 32 bit Visual Studio 11.0 runtimes are not installed.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

mooninsum
Posts: 4
Joined: Mon Sep 23, 2013 1:39 pm

Re: I get an Exception when use RCFProto

Post by mooninsum »

Thank you, jarl. I fix it.

Then, I try it in Python and I get the same Problem:

File "D:\MiniProject\code-F\RCFProto\script\deltavsoft\util.py", line 14, in LoadRCFProtoNativeDll
_mod = imp.load_module('_rcfproto', fp, pathname, description)
ImportError: DLL load failed

Do you know How to fix it?

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: I get an Exception when use RCFProto

Post by jarl »

Did you install a 32 or 64 bit Python interpreter? Which one is being used to run your script?

If you run 32 bit Python, the 32 bit DLL needs to be loaded. Similarly, if you are running 64 bit Python, the 64 bit DLL needs to be loaded.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

mooninsum
Posts: 4
Joined: Mon Sep 23, 2013 1:39 pm

Re: I get an Exception when use RCFProto

Post by mooninsum »

My Python is 32 bit, and I copy the "python\bin\x86\_rcfproto.pyd" to "deltavsoft" in my project. is it right?
And what is the Dll that you say? Is it _rcfproto.pyd?

BTW, if I run it in Linux, where is .so I can find?

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: I get an Exception when use RCFProto

Post by jarl »

You need to first install the RCFProto Python module into your interpreter, by going to the python/src directory and running

Code: Select all

python setup.py install
(see the demo at http://www.deltavsoft.com/RCFProto/dist ... ython.html).

Once you've done that you should be able to run your script and it should find the _rcfproto.pyd file automatically.

If you want to avoid installing the RCFProto python module, you'll need to put _rcfproto.pyd in a place where Python will find it. We use imp.find_module() to load _rcfproto.pyd, and the logic it follows is described here:

http://docs.python.org/2/library/imp.html

To run your script on Linux, you will need to build the _rcfproto.pyd Python extension yourself, as described in the documentation:

http://www.deltavsoft.com/RCFProto/dist ... ython.html
http://www.deltavsoft.com/RCFProto/doc/ ... nd_python_

Currently Windows is the only platform we ship ready made binary distributions for.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

mooninsum
Posts: 4
Joined: Mon Sep 23, 2013 1:39 pm

Re: I get an Exception when use RCFProto

Post by mooninsum »

I do install like you said , but it also raise Error:

File "D:\MiniProject\code-F\RCFProto\script\deltavsoft\util.py", line 14, in LoadRCFProtoNativeDll
_mod = imp.load_module('_rcfproto', fp, pathname, description)
ImportError: DLL load failed

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: I get an Exception when use RCFProto

Post by jarl »

Are you able to run the Python demo from the Windows distribution?

http://www.deltavsoft.com/RCFProto/dist ... ython.html
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

Post Reply