Lazarus

Programming => General => Topic started by: pedropadel on February 15, 2013, 11:07:13 pm

Title: Connection with R-Project
Post by: pedropadel on February 15, 2013, 11:07:13 pm
Hello

I'm trying to translate the following application Delphi to Lazarus but I get errors with the following libraries: OleCtrls, OleServer, StdCtrls, OleServer, StdVCL

The application is for connecting with R-Project (statistical software). It is this one:

http://www.menne-biomed.de/download/RDcomDelphi.zip (http://www.menne-biomed.de/download/RDcomDelphi.zip)

What could be the solution? Is there any example in connection R-Project from Lazarus.

I would be very grateful if you could help me.

Thank you very much!
Title: Re: Connection with R-Project
Post by: jwdietrich on February 15, 2013, 11:14:32 pm
This is a very interesting project. Do you have any additional documentation at hand? The web site http://www.menne-biomed.de doesn't seem to be too informative with regard to this issue.
Title: Re: Connection with R-Project
Post by: pedropadel on February 16, 2013, 03:30:29 pm
No, I have only this code Delphi

Also I have another example, but using a DLL in VB.NET.

Interop.STATCONNECTORCLNTLib.dll
Interop.StatConnectorCommonLib.dll
Interop.STATCONNECTORSRVLib.dll


Code: [Select]
Imports STATCONNECTORCLNTLib
Imports StatConnectorCommonLib
Imports STATCONNECTORSRVLib

Dim sc1 As StatConnector = New STATCONNECTORSRVLib.StatConnectorClass()
sc1 = New STATCONNECTORSRVLib.StatConnectorClass()
sc1.Init("R")
sc1.Evaluate("1+1")


How are DLLs with Lazarus? Perhaps that could be a solution ...
Title: Re: Connection with R-Project
Post by: jwdietrich on February 16, 2013, 04:29:01 pm
The code provided by Dieter Menne is interesting, but not versatile. It uses COM interfaces and DLLs making the software restricted to Windows.

A cross-platform solution would be preferable, e.g. by using embedded shell calls.
Title: Re: Connection with R-Project
Post by: Leledumbo on February 16, 2013, 04:50:31 pm
Quote
How are DLLs with Lazarus? Perhaps that could be a solution ...
How what? Create or link? Well, in any case, consult the documentation: http://www.freepascal.org/docs-html/prog/progch12.html
Title: Re: Connection with R-Project
Post by: pedropadel on February 16, 2013, 07:21:34 pm
Quote
How are DLLs with Lazarus? Perhaps that could be a solution ...
How what? Create or link? Well, in any case, consult the documentation: http://www.freepascal.org/docs-html/prog/progch12.html

Link. How to link a DLL?
Title: Re: Connection with R-Project
Post by: Leledumbo on February 17, 2013, 12:04:44 am
Quote
Link. How to link a DLL?
You have must declare the function(s) you'd like to call from the dll using external declaration AND call it in your program. The DLL will then be automatically linked.
Title: Re: Connection with R-Project
Post by: pedropadel on February 17, 2013, 12:02:22 pm
The code provided by Dieter Menne is interesting, but not versatile. It uses COM interfaces and DLLs making the software restricted to Windows.

A cross-platform solution would be preferable, e.g. by using embedded shell calls.

I do not care that is only for windows. How would that another solution, using embedded shell calls?
Thanks very much!
Title: Re: Connection with R-Project
Post by: pedropadel on February 17, 2013, 12:03:35 pm
Quote
Link. How to link a DLL?
You have must declare the function(s) you'd like to call from the dll using external declaration AND call it in your program. The DLL will then be automatically linked.

Please would you have a sample code? Thank you very much!
Title: Re: Connection with R-Project
Post by: Leledumbo on February 17, 2013, 01:30:34 pm
Quote
Please would you have a sample code? Thank you very much!
Read my link
Title: Re: Connection with R-Project
Post by: jwdietrich on February 17, 2013, 06:56:51 pm
The code provided by Dieter Menne is interesting, but not versatile. It uses COM interfaces and DLLs making the software restricted to Windows.

A cross-platform solution would be preferable, e.g. by using embedded shell calls.

I do not care that is only for windows. How would that another solution, using embedded shell calls?
Thanks very much!

This if performed with fpsystem (http://wiki.freepascal.org/Executing_External_Programs#Unix_fpsystem.2C_fpexecve_and_shell) on Unix-based systems. See http://wiki.freepascal.org/Lazarus_on_Raspberry_Pi#Hardware_access_via_encapsulated_shell_calls for an example. The same technique is possible for invoking commands and statements in R (and, of course, other S implementations)
TinyPortal © 2005-2018