3

I have a lot of code in Delphi I would like to use in python. In Delphi XE is an option to generate C / C + + files. obj Can I generate these files. Obj in Delphi and use it in python code

python code to use it. obj will still be cross-platform?

1
  • If your question left out the spurious idea about obj files it would be a duplicate of this question: Learn to write a Python extension using delphi: stackoverflow.com/questions/8244121/… Commented Nov 9, 2013 at 22:17

1 Answer 1

2

Delphi generated .obj files cannot be consumed by Python because Python doesn't consume .obj files. You'd need to compile them to a library at the very least. At which point, emitting .obj files is pointless – you may as well just output a full module. I conclude that you'll need to compile your Delphi code to a library (DLL) or a COM object.

To support multiple platforms, you'll need to compile separately for each platform. Which means that you'll only be able to support platforms on which Delphi compilers exist. FreePascal has wider platform support and may be a better choice.

Obviously COM would restrict you to Windows. So the other option is a library. This can be consumed using ctypes or by making your module a Python extension module.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.