Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-05

dot net dll in free pascal?

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

A sizeable part of my day job is to program PLCs in the worst software environment ever (for the curious, simatic tia portal, actually I'm mostly using the older, only marginally better, step 7, but the times they are a-changin').
Said piece of sh^H^Hfine engineering, provides a dll to automate some tasks, however, being a steaming pile of...fine engineering, it's made with dot net and the instructions on how to use it only mention visual something (page 12 of this document
https://support.industry.siemens.com/cs/attachments/108716692/108716692_TIA_Openness_GettingStartedAndDemo_V14SP1_en.pdf).

Is it possible to someway use it with fpc?
I tried the "import type library.." menu item that lazarus provides with no success ("error loading the dll", strangely enough localized even if my lazarus is in english, so I suppose that comes from windows).

The file command under Linux says:
Siemens.Engineering.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows

TIA (pun intended)

Luca

Reply by email

Sven Barth
to Luca Olivetti

Luca Olivetti schrieb am Mo., 13. Mai 2019, 23:14:

Show quoted text 21 lines
A sizeable part of my day job is to program PLCs in the worst software environment ever (for the curious, simatic tia portal, actually I'm mostly using the older, only marginally better, step 7, but the times they are a-changin'). Said piece of sh^H^Hfine engineering, provides a dll to automate some tasks, however, being a steaming pile of...fine engineering, it's made with dot net and the instructions on how to use it only mention visual something (page 12 of this document https://support.industry.siemens.com/cs/attachments/108716692/108716692_TIA_Openness_GettingStartedAndDemo_V14SP1_en.pdf ). Is it possible to someway use it with fpc? I tried the "import type library.." menu item that lazarus provides with no success ("error loading the dll", strangely enough localized even if my lazarus is in english, so I suppose that comes from windows). The file command under Linux says: Siemens.Engineering.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows

You could try to host the .Net CLR. I've never done it, but there exists code for that for Delphi:
https://sourceforge.net/projects/dotnetruntimelibraryfordelphi/ So that should be possible in FPC as well.

Regards,
Sven

Reply by email

Luca Olivetti
to Sven Barth

El 14/5/19 a les 0:15, Sven Barth via fpc-pascal ha escrit:

Show quoted text 9 lines
The file command under Linux says: Siemens.Engineering.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows You could try to host the .Net CLR. I've never done it, but there exists code for that for Delphi: https://sourceforge.net/projects/dotnetruntimelibraryfordelphi/ So that should be possible in FPC as well.

Thank you but:

"Delphi or RAD Studio has not been installed on this computer. The .Net Runtime Library for Delphi Trial Edition 6.0.6.0 requires an installed and licensed Delphi or RAD Studio 2010, XE, XE2 and higher versions".

Bye

Luca

Reply by email

Sven Barth
to Luca Olivetti

Luca Olivetti schrieb am Di., 14. Mai 2019, 09:13:

Show quoted text 19 lines
El 14/5/19 a les 0:15, Sven Barth via fpc-pascal ha escrit: > The file command under Linux says: > Siemens.Engineering.dll: PE32 executable (DLL) (console) Intel 80386 > Mono/.Net assembly, for MS Windows > > > You could try to host the .Net CLR. I've never done it, but there exists > code for that for Delphi: > https://sourceforge.net/projects/dotnetruntimelibraryfordelphi/ > So that should be possible in FPC as well. Thank you but: "Delphi or RAD Studio has not been installed on this computer. The .Net Runtime Library for Delphi Trial Edition 6.0.6.0 requires an installed and licensed Delphi or RAD Studio 2010, XE, XE2 and higher versions".

Hmm... I did not see that this is a commercial solution. What is something like that doing on SourceForge?! -.-

Well as an alternative you can try the .Net hosting code from the JCL, though I don't know what changes you'd need to do to get the necessary units working with FPC:

https://github.com/project-jedi/jcl/blob/master/jcl/source/windows/JclDotNet.pas https://adamjohnston.me/delphi-dotnet-interop-with-jvcl/

Also it seems that this code requires the assembly to have a COM visible API, so you'd need to test this.

Alternatively here is an example by Microsoft to host the CLR yourself.

https://code.msdn.microsoft.com/CppHostCLR-e6581ee0

In both cases you'll have to create type library imports for mscoree and mscorlib.

Regards,
Sven

Reply by email

Luca Olivetti
to Sven Barth

El 14/5/19 a les 14:12, Sven Barth via fpc-pascal ha escrit:

Show quoted text 20 lines
Hmm... I did not see that this is a commercial solution. What is something like that doing on SourceForge?! -.- Well as an alternative you can try the .Net hosting code from the JCL, though I don't know what changes you'd need to do to get the necessary units working with FPC: https://github.com/project-jedi/jcl/blob/master/jcl/source/windows/JclDotNet.pas https://adamjohnston.me/delphi-dotnet-interop-with-jvcl/ Also it seems that this code requires the assembly to have a COM visible API, so you'd need to test this. Alternatively here is an example by Microsoft to host the CLR yourself. https://code.msdn.microsoft.com/CppHostCLR-e6581ee0 In both cases you'll have to create type library imports for mscoree and mscorlib.

Thank you, I'll see if I can do something with any of those links.

Bye

Luca

Reply by email