shared library created by ifort can't be imported correctly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

shared library created by ifort can't be imported correctly

博陈
The julia code:

!f90tojl.f90
module m
contains
    integer function five()
       five = 5
    end function five
end module m

The corresponding julia code:
#test.jl
println(ccall( (:__m_MOD_five, "f90tojl"), Int, () ))

The test command and the result: (test is the directory, not a command)
➜  test gfortran -shared -fpic f90tojl.f90 -o f90tojl.so
➜  test julia test.jl                                   
5
➜  test ifort -shared -fpic f90tojl.f90 -o f90tojl.so
➜  test julia test.jl                                
ERROR: LoadError: ccall: could not find function __m_MOD_five in library f90tojl
 in anonymous at no file
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:320
 in process_options at ./client.jl:280
 in _start at ./client.jl:378
while loading /home/chen/test/test.jl, in expression starting on line 1

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: shared library created by ifort can't be imported correctly

Angel de Vicente
Hi,

博陈 <[hidden email]> writes:

> The julia code:
>
> !f90tojl.f90
> module m
> contains
> integer function five()
> five = 5
> end function five
> end module m
>
> The corresponding julia code:
> #test.jl
> println(ccall( (:__m_MOD_five, "f90tojl"), Int, () ))
>
> The test command and the result: (test is the directory, not a command)
> ➜ test gfortran -shared -fpic f90tojl.f90 -o f90tojl.so
> ➜ test julia test.jl
> 5
> ➜ test ifort -shared -fpic f90tojl.f90 -o f90tojl.so
> ➜ test julia test.jl
> ERROR: LoadError: ccall: could not find function __m_MOD_five in library f90tojl
> in anonymous at no file
> in include at ./boot.jl:261
> in include_from_node1 at ./loading.jl:320
> in process_options at ./client.jl:280
> in _start at ./client.jl:378
> while loading /home/chen/test/test.jl, in expression starting on line
> 1

You can check list of symbols in the created library with the command
nm. With gfortran your "five" function will be called __m_MOD_five as in
your Julia call, buth with Ifort you will have to use m_mp_five_

,----
| angelv@carro:~/temp$ nm testgfort.so | grep five
| 0000000000000635 T __m_MOD_five
|
| angelv@carro:~/temp$ nm testifort.so | grep five
| 0000000000000740 T m_mp_five_
`----

Cheers,
--
Ángel de Vicente
http://www.iac.es/galeria/angelv/         
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: shared library created by ifort can't be imported correctly

博陈


在 2016年11月15日星期二 UTC+8下午4:29:17,Ángel de Vicente写道:
Hi,

博陈 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="0YxW7ZjPBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">chenph...@...> writes:

> The julia code:
>
> !f90tojl.f90
> module m
> contains
> integer function five()
> five = 5
> end function five
> end module m
>
> The corresponding julia code:
> #test.jl
> println(ccall( (:__m_MOD_five, "f90tojl"), Int, () ))
>
> The test command and the result: (test is the directory, not a command)
> ➜ test gfortran -shared -fpic f90tojl.f90 -o f90tojl.so
> ➜ test julia test.jl
> 5
> ➜ test ifort -shared -fpic f90tojl.f90 -o f90tojl.so
> ➜ test julia test.jl
> ERROR: LoadError: ccall: could not find function __m_MOD_five in library f90tojl
> in anonymous at no file
> in include at ./boot.jl:261
> in include_from_node1 at ./loading.jl:320
> in process_options at ./client.jl:280
> in _start at ./client.jl:378
> while loading /home/chen/test/test.jl, in expression starting on line
> 1

You can check list of symbols in the created library with the command
nm. With gfortran your "five" function will be called __m_MOD_five as in
your Julia call, buth with Ifort you will have to use m_mp_five_

,----
| angelv@carro:~/temp$ nm testgfort.so | grep five
| 0000000000000635 T __m_MOD_five
|
| angelv@carro:~/temp$ nm testifort.so | grep five
| 0000000000000740 T m_mp_five_
`----

Cheers,
--
Ángel de Vicente
<a href="http://www.iac.es/galeria/angelv/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.iac.es%2Fgaleria%2Fangelv%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHWgWJwB7xZkScAhM-XaTehlCOVww&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.iac.es%2Fgaleria%2Fangelv%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHWgWJwB7xZkScAhM-XaTehlCOVww&#39;;return true;">http://www.iac.es/galeria/angelv/          



Thank you very much. The "nm" is a very powerful tool! 
Loading...