devcartel / pyrfa

Open sourced Python API for Refinitiv (Thomson Reuters) Enterprise Platform.
http://devcartel.com/pyrfa
MIT License
50 stars 15 forks source link

pyrfa in .NET? #21

Closed laurentbeaumer closed 7 years ago

laurentbeaumer commented 7 years ago

Hi

I have been trying to call pyrfa from .NET (C#).

It doesn't work with IronPython as the latter doesn't support pyd files.

So I am now trying with Python .NET (pythonnet).

Using Python .NET, the code creates a dynamic object from pyrfa.

I have been trying to invoke/use different methods ("createConfigDb", etc.) but I get an error like: "'Python.Runtime.PyObject' does not contain a definition for 'createConfigDb'"

My question: is there a way to call pyrfa from C#/.NET?

Thanks

wiwat-tharateeraparb commented 7 years ago

I've never tried but I don't think that's possible as PyRFA is built with C/C++.

laurentbeaumer commented 7 years ago

Thanks, it was a quick reply.

Just for information, Python .NET is wrapper around pythonXX.dll and uses P/Invoke, the same way for any DLL with unmanaged code (including C/C++).

For example, it works with NumPy. So theoretically, it could have worked with PyRFA...

wiwat-tharateeraparb commented 7 years ago

Can you import pyrfa in pythonnet?

natalie-o-perret commented 7 years ago

@laurentbeaumer, agreed, it might do the trick. Actually, it can be boiled down to just a matter of language A, Python being consumed by another language B aka .NET C#. That being said, it would better to directly consume the C/C++ dll though C# P/Invoke rather than passing through yet another layer.

laurentbeaumer commented 7 years ago

I have posted the issue also on the Github of pythonnet, and it has been resolved: https://github.com/pythonnet/pythonnet/issues/266

laurentbeaumer commented 7 years ago

Thanks all

wiwat-tharateeraparb commented 7 years ago

PyRFA 8.0.2 now supports unicode strings.