Where did you compile that from? Maybe you were trying to use the cygwin 
version of gfortran instead of the mingw cross-compiler version 
(x86_64-w64-mingw32-gfortran) ? That test file and ccall invocation gives 
an EXCEPTION_ACCESS_VIOLATION for me, I think you need to pass parameters 
by reference.

ccall((:__nuts_MOD_foo, "nuts.so"), Int32, (Ref{Int32},), 3)

works for me on Julia 0.4-dev, or

ccall((:__nuts_MOD_foo, "nuts.so"), Int32, (Ptr{Int32},), &3)

on Julia 0.3.


On Monday, July 13, 2015 at 3:39:05 PM UTC-7, LarryD wrote:
>
> I'm afraid I'm not getting anywhere. I decided to forget the SilverFrost 
> compiler and go with gfortran, attempting to mimic the examples I've found 
> online.  My test Fortran code is
>
> !fileName = nuts.f95
> module nuts
> integer none
> contains
> function foo(i)
>   integer :: i, foo
>   foo = i + 3
> end function foo
> end module nuts
>
> I compiled with
>
> gfortran nuts.f95 -o nuts.so -shared -fPIC
>
> and got the warning message 
>
> f951.exe: warning: -fPIC ignored for target (all code is position 
> independent).
>
> Since a nuts.so file was generated I tried the ccall:  (my working 
> direcfory is c:\users\larry\juliastuff)
>
> ccall((:__nuts_MOD_foo, "C:\\Users\\Larry\\JuliaStuff\\nuts.so"), Int32, 
> (Int32,), 3)
>
> and got the error message
>
> error compiling anonymous: could not load module 
> C:\Users\Larry\JuliaStuff\nuts.so: The specified module could not be found.
>
> Clearly I'm doing some thing(s) wrong. Why am I getting the Fortran 
> warning that nobody else gets, and why can't ccall find the module?
>
> Thanks in advance for your time and patience with a newbie.
>
> Larry
>
> On Saturday, July 11, 2015 at 12:31:44 PM UTC-5, Tony Kelman wrote:
>
>> I've never heard of that compiler, which surprises me a little. It looks 
>> like it's primarily for 32 bit Windows, so you'll need to use a 32 bit 
>> version of Julia to call into shared libraries built using that compiler. 
>> If you have access to the Fortran source you could also try rebuilding with 
>> the more common open-source MinGW-w64 version of gfortran, for either 32 or 
>> 64 bit Windows. If you only have access to compiled binaries, are they 
>> shared libraries (dlls) or static libraries? If they're dll's, you can try 
>> looking at them using Dependency Walker to see what the exported symbol 
>> names are, then call them according to the "interfacing with C and Fortran" 
>> documentation. If you only have static libraries, you could try calling the 
>> linker to build a shared library out of them.
>>
>>
>> On Saturday, July 11, 2015 at 6:36:30 AM UTC-7, Stefan Karpinski wrote:
>>>
>>> In general, the only issues with calling Fortran involve calling 
>>> convention incompatibility with C. There's a fairly old issue about 
>>> implementing fcall <https://github.com/JuliaLang/julia/issues/2167> (cf 
>>> ccall), which natively emits calls using the Fortran calling convention. 
>>> Have you tried calling code compiled with this compiler and had problems?
>>>
>>> On Saturday, July 11, 2015, LarryD <[email protected]> wrote:
>>>
>>>> I'm just starting to learn Julia, so I apologize for dumb questions.  
>>>> Does anybody have experience calling stuff written in SilverFrost Fortran 
>>>> from Julia? Thanks.
>>>>
>>>> LarryD
>>>>
>>>>

Reply via email to