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 

Creating a dll in Plato IDE and using with Visual Basic

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



Joined: 01 Nov 2006
Posts: 3

PostPosted: Thu Nov 02, 2006 1:21 am    Post subject: Creating a dll in Plato IDE and using with Visual Basic Reply with quote

Hi everyone,
I am trying to create a Fortran dll using the Plato IDE that can be used in my Visual Basic programs. I would like to know the procedures required to

1.) Make a dll using Plato (including settings required, etc)
2.) Implement the dll in Visual Basic (including declarations and references, etc)

Also has any one got any websites or information they could share regarding how data is passed between the dll and Visual Basic (e.g. what data types can be used) and if there are any pitfalls, etc.

Thanks in advance. Very Happy

Stuart
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Nov 03, 2006 12:42 am    Post subject: Creating a dll in Plato IDE and using with Visual Basic Reply with quote

Stuart

The place to start is "Calling an FTN95 DLL from Visual Basic" in the FTN95 help file.

You need to create a "Fortran Application Extension" project in Plato3.

You can pass simple scalars and arrays (by reference) but avoid passing strings.

Try to avoid using global data in the DLL otherwise things get more difficult (you will need to use LoadLibrary and possibly your own "DLLMain")

Use F_STDCALL in your subprogram definition.
Back to top
View user's profile Send private message AIM Address
hillbilly78



Joined: 01 Nov 2006
Posts: 3

PostPosted: Fri Nov 03, 2006 3:18 am    Post subject: Creating a dll in Plato IDE and using with Visual Basic Reply with quote

I have created a Fortran Application Extension project with just one function in which is:

F_STDCALL INTEGER*4 FUNCTION MyFunc(X)
INTEGER*4 X
MyFunc=X
END

I have created the DLL called "FortranTestDLL.dll" (ticking the export all option under Project->Properties->Linker Options) and then placed it in my Visual Basic project directory. In my Visual Basic Project I declared the function in the DLL using:

Public Declare Function MyFunc Lib "FortranTestDLL.dll" (ByRef X As Long) As Long

When the VB project is executed an error occurs which is

"Run-time error '453':

Can't find DLL entry point MyFunc in FortranTestDLL.dll"

Is there something else I am missing?

Thanks,
Stuart
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Nov 03, 2006 5:01 am    Post subject: Creating a dll in Plato IDE and using with Visual Basic Reply with quote

Fortran exports are uppercase MYFUNC.
Back to top
View user's profile Send private message AIM Address
hillbilly78



Joined: 01 Nov 2006
Posts: 3

PostPosted: Fri Nov 03, 2006 6:12 am    Post subject: Creating a dll in Plato IDE and using with Visual Basic Reply with quote

That works fine now, thanks.

Stuart
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