From mpdotbook at gmail.com  Mon Aug 25 17:45:28 2008
From: mpdotbook at gmail.com (rcoder)
Date: Mon, 25 Aug 2008 08:45:28 -0700 (PDT)
Subject: [Rd] problem running dll in R
In-Reply-To: <48B2A3FB.9070401@stats.uwo.ca>
References: <19126733.post@talk.nabble.com> <48B2A3FB.9070401@stats.uwo.ca>
Message-ID: <19146333.post@talk.nabble.com>


Hi Duncan,

Thanks for your reply. Would you know of a code + compiler combination that
works in R, so I can get a feel for the process?

Thanks,

rcoder



Duncan Murdoch-2 wrote:
> 
> On 23/08/2008 8:44 PM, rcoder wrote:
>> Hi everyone,
>> 
>> I've created a dll for a fortran subroutine, and when I call the
>> subroutine
>> in R (via a wrapped function) a standard program shutdown windows error
>> prompt immediately pops up: the program has encountered a problem and
>> needs
>> to be shut down... send message / don't send message to MS... etc.
>> 
>> When I click "Don't send", the R consol does not then shut down, and
>> appears
>> to continue to execute, and task manager does not indicate "not
>> responding".
>> The problem is the execution takes too long, and I think the program is
>> just
>> hanging rather than executing. I have tested with different fortran code,
>> and the same thing happens, so I don't think it is anything to do with
>> that
>> side of things.
>> 
>> I created fortran code in a text editor, compiled using Plato3 IDE, then
>> converted the file into a dll using gFortran. I place the dll in the R
>> directory and it load in the console. The problem seems to occur when
>> defining the data types in R, for the variables in the fortran routine.
>> 
>> I was just wondering if anyone has experienced anything similar when
>> trying
>> to call fortran subroutines in R?
> 
> I haven't seen that, and haven't used that particular compiler, but it 
> has the symptoms of a mismatch in calling conventions.  Does your 
> compiler pass arguments in registers?  R uses what Windows calls the 
> cdecl calling convention in external calls.
> 
> Some old advice on using non-standard compilers is available here:
> 
> http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs
> 
> I haven't updated it in a few years, but I think it is still current.
> 
> Duncan Murdoch
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
View this message in context: http://www.nabble.com/problem-running-dll-in-R-tp19126733p19146333.html
Sent from the R devel mailing list archive at Nabble.com.



[Rd] problem running dll in R
rcoder