replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Problem calling Fortran from VB6
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem calling Fortran from VB6

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Kent Lyons



Joined: 10 Dec 2009
Posts: 14
Location: Miami, FL USA

PostPosted: Fri Sep 23, 2011 10:36 pm    Post subject: Problem calling Fortran from VB6 Reply with quote

Hi,

This is embarrassing because I took some working code that passed arrays back and forth between vb6 and Fortran and I broke it. In an effort to debug the problem I ended up eliminating all passed variables, but it still doesn�t work. I am beyond mystified. Help!

The Fortran subroutine executes fine when called from another Fortran routine, however, when I call it from vb it does not work. Thus I include only a little of the Fortran:

! Subroutine CALLED_FROM_VB() ! use this line when called from Fortran
F_STDCALL Subroutine CALLED_FROM_VB() ! use this line when called from vb

Write a file to show the Fortran worked



------------------------ vb code:

Module level stuff:

Option Explicit
Private Declare Sub CALLED_FROM_VB Lib "C:\TurboVision\Design_System\Library\AIRFOIL_CALC.dll" ()


In subroutine:

Call CALLED_FROM_VB


Both AIRFOIL_CALC and salflibc DLLs are at the location specified in the declare statement


----------------- Computer configuration:

PC running Vista office edition 64 bit SP2

Silverfrost FTN95 Version: 5.50 License: FULL


------------------------Compiler Stuff

Switches /IGNORE 179 684 /FPP
Output filename Release\Win32\AIRFOIL_CALC.dll
Output filetype DLL
Preprocess source files is checked
Linker Options - Export all is checked


Any help would be appreciated. I have spent most of a day on this apparently trivial problem

Regards,
Kent
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Sat Sep 24, 2011 8:04 am    Post subject: Reply with quote

1) Have you read the help information on this topic in ftn95.chm and on this forum?

2) Is your DLL "visible" to your VB (i.e. does it access the DLL)?
Back to top
View user's profile Send private message AIM Address
Kent Lyons



Joined: 10 Dec 2009
Posts: 14
Location: Miami, FL USA

PostPosted: Mon Sep 26, 2011 1:28 pm    Post subject: Reply with quote

Hi Paul,

Yes, I believe I have read all the help info available, several times.

Yes, the DLL appears to be visible - I don't get any error when calling the subroutine.

More info - when I was passing several arrays, Excel crashed as soon as I called the DLL. After I eliminated the arguments Excel did not crash, but the DLL did not execute (it writes a one line file). The DLL did execute properly when I called it from Fortran (after, of course, changing the subroutine first line back to the standard Fortran callable version)

Thanks,
Kent
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group