在 2016年11月15日星期二 UTC+8下午4:29:17,Ángel de Vicente写道: > > Hi, > > 博陈 <chenph...@gmail.com <javascript:>> 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/ >
Thank you very much. The "nm" is a very powerful tool!