Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

From command prompt how do I link in DLL

dfstrottersfan
Beginner
1,618 Views
I have created a DLL for use in another application. I am trying to test the functions in the dll by creating an exe with a simple call to the functions.
I cannot work out how to link in the dll I know it is documented somewhere but where?
e.g.
f77 fred.for fred1.for/dll:fred
f77 mymainprog /exe=mainprog /lib????:fred.dll
can you 'add' to an existing dll
Sorry I am a VMS user; windows is a bit alien to me.as yet.....
thanks

Thanks

====================================

I decided that I would try from the visual workbench - I created a DLL project with a few simple functions in it. I seemed to succeed but when I use the .DLL in the CA OpenRoad application I am trying to create it comes up with the error in the attached .jpeg

unable to find dforrtd.dll

I cannot find this DLL anywhere on my PC....

Message Edited by dfstrottersfan on 12-15-2003 05:49 AM

0 Kudos
14 Replies
Lorri_M_Intel
Employee
1,618 Views

When you created the DLL, there should have also been a .LIB created. The easiest way to "link" against a DLL is to link against the .LIB.

In other words,

f77 fred.for fred1.for/dll:fred
should have created both fred.dll and fred.lib
Your command to create the exe that uses fred would be:
f77 mymainprog /exe=mainprog fred.lib
Now, about your other question:
"can you 'add' to an existing dll"
Ah ... I'm not sure exactly what you're asking, but let me guess you want to be able to simply add to the .dll in the same way you can add to object libraries on VMS. Sorry, it doesn't work that way ;-) DLLs are more like shareable images than object libraries. To add to them you need to recreate them.
Hopefully this helps!
- Lorri

Message Edited by Lorri_menard on 12-12-2003 09:35 AM

0 Kudos
Steven_L_Intel1
Employee
1,618 Views
Adding to Lorri's advice - there is a chapter in the Programmer's Guide on creating and using DLLs. It is somewhat more involved than just saying /dll on the command line - you have to add directives to "export" your routines, similar to the options file you use on VMS to create a shareable image.
0 Kudos
dfstrottersfan
Beginner
1,618 Views

I decided that I would try from the visual workbench - I created a DLL project with a few simple functions in it. I seemed to succeed but when I use the .DLL in the CA OpenRoad application I am trying to create it comes up with the error in the attached .jpeg

unable to find dforrtd.dll

I cannot find this DLL anywhere on my PC....

0 Kudos
Steven_L_Intel1
Employee
1,618 Views
If your DLL is looking for dformtd.dll, that means you built the DLL in a "debug configuration", which cannot be redistributed to other PCs. Select a "release" configuration and build that instead.
0 Kudos
dfstrottersfan
Beginner
1,618 Views

Thanks,

I have changed my settings as below but still get the dforrtd.dll error.

The only DLL which is being produced is in the /DEBUG directory I dont get a "release" version in the parent directory.

I don't understand how to createa release version other than doing this --- Help please!!

In project /settings/ fortran [general] I set Debug to None

project /settings/link [general] generate debug info [off]

Tools options / debug - everything off

0 Kudos
dfstrottersfan
Beginner
1,618 Views

Sorry - found the release configuration button - all I have to do now is work out how to "export" the functions into the DLL - I suspect I have to use

!DEC$ ATTRIBUTES DLLEXPORT::fred

Gosh why didn't DEC give the PC world VMS -- its so much better

thanks......

0 Kudos
dfstrottersfan
Beginner
1,618 Views

I found this on the internet (its nearly correct ) It works

http://www.canaimasoft.com/f90VB/OnlineManuals/UserManual/TH_60.htm

0 Kudos
Steven_L_Intel1
Employee
1,618 Views
I like VMS too, but you'd have a similar issue there - the need of a linker options file to specify the routines to make "universal" so that they are visible from the shareable image.
0 Kudos
dfstrottersfan
Beginner
1,618 Views
Just back to this :----
Does anyone know how to input a whole list of files (approx100) into the compiler (to create a DLL). I cannot use the visual environment because some of the files are preprocessed to fortranby an INGRES preprocessor..
this works .....
f77 /dll /dll:list.dll fred.for fred1.for! creates a dll called fred.dll
I have tried this and it does not work
f77 /dll /dll:list.dll ! files.lis contains a list of files
e.g.
type files.lis
fred.for
fred1.for
0 Kudos
dfstrottersfan
Beginner
1,618 Views
in previous thread I said that
f77 /dll /dll:list.dll fred.for fred1.for worked
it doesn't but
f77fred.for fred1.for /dll /dll:list.dll does
still cannot work how to feed a list of files into the compiler
0 Kudos
durisinm
Novice
1,618 Views

You might try using a wildcard specification in your command, like f77fred*.for /dll /dll:list.dll, if all your Fortran file names begin with fred. I seem to remember another thread in this forum in which someone said that this worked even though it's not documented.

Mike D.

0 Kudos
dfstrottersfan
Beginner
1,618 Views

Thanks - that worked - I actually tried it before I read your POST - thinking maybe this will work - bizzare !!!

I now have a different issue with the following error messages

obj11DE.tmp : error LNK2001: unresolved external symbol _IIsqInit
obj11DE.tmp : error LNK2001: unresolved external symbol _IIsqMods
obj11DE.tmp : error LNK2001: unresolved external symbol _IIslen
obj11DE.tmp : error LNK2001: unresolved external symbol _IIxwritio
obj11DE.tmp : error LNK2001: unresolved external symbol _IIretinit
obj11DE.tmp : error LNK2001: unresolved external symbol _IInextget
obj11DE.tmp : error LNK2001: unresolved external symbol _IIxgetdomio
obj11DE.tmp : error LNK2001: unresolved external symbol _IIsqFlush
obj11DE.tmp : error LNK2001: unresolved external symbol _IIgetdomio
obj11DE.tmp : error LNK2001: unresolved external symbol _IIxputdomio
obj11DE.tmp : error LNK2001: unresolved external symbol _IIputdomio
obj11DE.tmp : error LNK2001: unresolved external symbol _IIsyncup

I know that these modules are in E:IngresIIingreslibingres.lib
this is the command line I am using (not wrapped as below) - how can I "link" in this library ..... thanks
f77 *.for -D_WIN32=1 -D_X86_=1 /name:as_is /iface:nomixed_str_len_arg /iface:cref/libs:static /dll /dll:fred.dll
0 Kudos
dfstrottersfan
Beginner
1,618 Views

I worked out how to add a library using the LIBenv variable and library name

I got this

/out:fred.dll
/dll
Creating library fred.lib and object fred.exp
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; us
e /NODEFAULTLIB:library
obj12A4.tmp : error LNK2001: unresolved external symbol _SQEEZE_P_GEN
obj12A4.tmp : error LNK2001: unresolved external symbol _IIxwritio
obj12A4.tmp : error LNK2001: unresolved external symbol _IIxgetdomio
obj12A4.tmp : error LNK2001: unresolved external symbol _IIxputdomio
fred.dll : fatal error LNK1120: 4 unresolved externals

but when I use the NODEFAULTLIB switch I get
(it is not wrapped on the command line)
E:ALLANALLANF~1>f77 *.for -D_WIN32=1 -D_X86_=1 /name:as_is /iface:nomixed_st
r_len_arg /iface:cref/libs:static /dll /dll:fred.dll /NODEFAULTLIB ingres.l
ib
f77: error
: Negation of '/NODEFAULTLIB' switch not allowed

and adding a name did not help

E:ALLANALLANF~1>f77 *.for -D_WIN32=1 -D_X86_=1 /name:as_is /iface:nomixed_st
r_len_arg /iface:cref/libs:static /dll /dll:fred.dll /NODEFAULTLIB:MSVCRT i
ngres.lib
f77: error:
Negation of '/NODEFAULTLIB:MSVCRT' switch not allowed

Can anyone help ?

Thanks Allan B

0 Kudos
Steven_L_Intel1
Employee
1,618 Views
You have to precede /nodefaultlib:libname with /link, but this is usually the wrong solution to this problem. You need to make sure that all the libraries are built with the same setting for the language libraries.
0 Kudos
Reply