Software Archive
Read-only legacy content
17060 Discussions

Callback from Fortran to VB

Intel_C_Intel
Employee
295 Views
I'm trying to call bak from Fortran (Visual Fortran) to Visual Basic (VB). Before I added the callback code, my Fortran code compiled and linked without a problem. I list the modifications I have introduced below. But here is the error message I get in the linking process:

" Linking...
LINK : fatal error LNK1181: cannot open input file "imsl.lib"

Error executing link.exe.

Memfor.dll - 1 error(s), 1 warning(s)"

If I remove "imsl.lib" from Project/Settings.../Link/Object/library module, I still get an error message - now over some other object.

Here is the basis for how I am trying to achieve callback.

In VB:
* I have defined a "callback"er function in a global module of VB.
* My call to Fortran has been expanded with one additional argument:

call Fortranroutine(T, AddressOf callback)

In Fortran:
* I have added 4 bytes in the number of argument bytes of the *.def file.
* The Fortranroutine code looks as follows:


subroutine Fortranroutine(T, VBcallback) 
 
real T 
integer i 
integer, external :: VBcallback 
 
i = VBcallback(T) 
....


Question:

--Does anyone see a problem with the way I have tried to organize the callback?

-- Does anyone see what is the problem with the linking process?

Thanks!
-Bernt Lie
0 Kudos
1 Reply
Steven_L_Intel1
Employee
295 Views
The error message from the link has nothing to do with the way you construct your callback. It simply can'tfind the library. Make sure that the path to ..DF98IMSLLIB is in the list under Tools..Options..Directories..Library Files

Steve
0 Kudos
Reply