Callback from Fortran to VB

Callback from Fortran to VB

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) 


--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?

-Bernt Lie

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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


Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today