fortran - Unresolved external symbol when linking a precompiled module -
i trying compile fortran file external precompiled module. first compile module file with:
ifort /c kdtree_mod.f90
it generates .mod files (kdtree2_module.mod, kdtree2_precision_module.mod, kdtree2_priority_queue_module.mod).
at beginning of subroutine have:
subroutine film(h,tinf,ts,n,time) use kdtree2_module
but when launch program gives me error:
user_film.obj : error lnk2019: unresolved external symbol kdtree2_module_mp_kdtree2_create referenced in function film user_film.obj : error lnk2019: unresolved external symbol kdtree2_module_mp_kdtree2_n_nearest referenced in function film user_film.exe : fatal error lnk1120: 2 unresolved externals link failed user_film.obj
procedure:
1. compile module ifort /c kdtree_mod.f90
2. launch msc marc user subroutine film.
run_marc -j name_input_file -u user_subroutine
3. error
msc marc commercial software has possibility create user subroutine.
update:
tried:
1. ifort /c kdtree_mod.f90
--> generate .obj file
run_marc -j name_input_file -obj name_obj.obj -u name_input_file
compiles fine error:
forrtl: severe (170): program exception - stack overflow image
pc routine line sourceuser_film.exe 0000000141d63717 unknown unknown unknown user_film.exe 000000013fd45c96 unknown
unknown unknown user_film.exe 000000013ff1ccc7 unknown
unknown unknown user_film.exe 000000013fd9495e unknown
unknown unknown user_film.exe 00000001405a819a unknown
unknown unknown user_film.exe 0000000140236b11 unknown
unknown unknown user_film.exe 000000013ffe32db unknown
unknown unknown user_film.exe 000000013ffee6c1 unknown
unknown unknown user_film.exe 000000013fe70fae unknown
unknown unknown user_film.exe 000000013fd51592 unknown
unknown unknown user_film.exe 000000013fd4105d unknown
unknown unknown user_film.exe 00000001424ce3dc unknown
unknown unknown user_film.exe 0000000141d638b2 unknown
unknown unknown kernel32.dll 0000000077475a4d unknown
unknown unknown ntdll.dll 00000000775ab831 unknown
unknown unknown
ifort /c kdtree_mod.f90 ifort /c user_film.f run_marc -j name_input_file -obj kdtree_mod.obj user_film.obj
read error: no such option: user_film.obj or input value: -b
seems not able pass both .obj files.ifort /c kdtree_mod.f90 ifort /c user_film.f kdtree_mod.obj ifort: warning #10146: no action performed specified object file(s)
marc in verbose: http://pastebin.com/6rd8v5eh
update 2 able compile dll file these commands:
ifort /nologo /iface:stdcall /libs:dll /threads /c kdtree_mod.f90 link /nologo /subsystem:windows /manifest /dll /out:kdtree_mod.dll kdtree_mod.obj mt /nologo “/outputresource:kdtree_mod.dll;#2″ /manifest kdtree_mod.dll.manifest
the useful information found on internet in german cad forum, says, there run_marc following:
fcomp=ifort ... fortran="$fcomp -c -assume byterecl -safe_cray_ptr $profile -save -zero -mp -wb -w90 -o1 $i8fflags -i$marc_source/common \ -i$marc_source/bcssolver/common -i$marc_source/mumpssolver/include $i8defines -dlinux -dlinux -dlinux_intel $fdefines $ddm $solverflags"
you need add -obj kdtree_mod.obj
or command line. descriptions there sounds possible link against libraries, might option create library , use via path more in line general usage of tool.
regarding first update: wouldn't have expected -obj
option work @ all. meant, need modify run_marc
script itself. according link above appears script variable containing run script in it. might case on unix systems, , on windows solved differently. did try run_marc
script? have no clue, first command in update, compiles, name_obj of sudden?
in second command, have expected like:
run_marc -j name_input_file -u user_film -obj kdtree_mod.obj
though, outlined above, don't think obj gets passed on.
regarding second update, , comment below:
besides linking need have module file available in include path. include path of compiler includes current working directory, if can put module file directory compiler executed, ought work. or put in 1 of directories stated via -i
options in compiling fortran
command above. or, modify command , add own include path it.
how command pastebin set userdll
option filled:
ifort /fpp /c /dwin32_intel -d_implicitnone /nologo -dmkl -dopenmp -domp_compat -d_mscmarc -dwin64 /i"c:\msc.software\marc\2014.0.0\marc2014\common" /i"c:\msc.software\marc\2014.0.0\marc2014\bcsgpusolver\common" /i"c:\msc.software\marc\2014.0.0\marc2014\mumpssolver\include" /i"c:\msc.software\marc\2014.0.0\marc2014\intelmpi\win64\include" /o2 /qip /qvec- /qsafe-cray-ptr /switch:fe_old_modvar /w0 /qopenmp /qopenmp-threadprivate:compat -dcasi -dpardiso -dmumps -dbcsgpu -dcuda /md -dddm /object:"c:\users\yellowhat\desktop\prova\user_film.obj" "c:\users\yellowhat\desktop\prova\user_film.f"
it looks c:\msc.software\marc\2014.0.0\marc2014\common
location put kdtree *.mod
files into.
Comments
Post a Comment