- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I trid to compile a fortran code which need use a subroutine available in another matlab libmat.dll file, I tried following command line
f90 test.f90 /libs:dll
but it always show error LNK2001: unresolved external symbol _MATOPEN@16.
This .dll file is really in path, can any one help me?
Thanks a lot
Xianyao Chen
I trid to compile a fortran code which need use a subroutine available in another matlab libmat.dll file, I tried following command line
f90 test.f90 /libs:dll
but it always show error LNK2001: unresolved external symbol _MATOPEN@16.
This .dll file is really in path, can any one help me?
Thanks a lot
Xianyao Chen
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Xianyao Chen,
Your compile-link command "f90 test.f90 /libs:dll" only specifies that standard FORTRAN libraries of the dll type (as opposed to static) are to be used.
It does not tell the linker where to find the matlab routine library.
There are two possibilities to make this work:
1. add the proper matlab library (?.lib) file to the command line. This assumesmatlab provides this library. Note ----this is a .lib file not a .dll file
2. If matlab does not provide the library, you will need to create an interface block in your routinefor allthe matlab subroutines youneed to access. Then you will have to add some code to load the matlab dll and get the address of the matlab routine you wish to use. See LOADLIBRARY(), and GETPROCADDRESS()
Good Luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is that a DLL isn't something you can link to. What you need to specify instead is the export library (.lib) created when the DLL was built. The DLL is looked for only at run-time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
While most linkers don't support it, there are linkers available that do not require an import library. They derive the information they need from the DLL. I forget which, but I was just reading about it last week.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We do have a tool that will generate an import library if you don't have one. There may indeed be linkers that will extract the necessary info from the DLL, but the MS linker we use doesn't.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page