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 

STDCALL and C_EXTERNAL improvement

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



Joined: 30 Jul 2012
Posts: 196

PostPosted: Wed Sep 10, 2014 4:31 pm    Post subject: STDCALL and C_EXTERNAL improvement Reply with quote

It would be nice to get support for variable number of arguments in STDCALL and C_EXTERNAL.

It could be defined with ..., something like:
Code:
C_EXTERNAL name 'alias' (INSTRING, ...)


I am currently prototyping a library for interfacing with COM (Component Object Model) directly from FTN95 and this functionality would be handy.

Currently I am forced to use something like, or is there a better way?:
Code:

integer :: pObject
integer :: argv(1)
character(20) :: fname

fname = 'test.txt'C
argv(1) = loc(fname)

call COMinit()
pObject = COMnew('Demo.Application')
call COMcall(pObject, 'Open', '%s', 1, argv)
call COMrelease(pObject)
call COMclose()


Basically, I am using a printf() style format string to define types of the variable number of arguments. Arguments are passed as a vector of pointers to parameters. I also pass the number of arguments for the function.

With support for variable number of arguments, I could get rid of argument vector and just pass the actual arguments for the function and let compiler worry about the rest.


Last edited by jalih on Thu Sep 11, 2014 6:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Sep 10, 2014 7:59 pm    Post subject: Reply with quote

Try using a signature with just one REF argument.
It might work for C_EXTERNAL apart from getting a load of warnings and these could be suppressed. I don't have time at the moment to try it. STDCALL is more tricky because of the decoration for the number of bytes passed.

Unfortunately we would not be able to provide the extension in the short to medium term.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Wed Sep 10, 2014 11:07 pm    Post subject: Reply with quote

This is probably a stupid comment of mine, but as Jalih is working on a COM interface, and at least one other user wants that functionality (asked for recently in the forum), might it not be worth giving Jalih whatever he needs for STDCALL and C_EXTERNAL to do it for you?

Unfortunately I haven't a clue what a COM object is, and wouldn't recognise one it if came up to me and bit me!

E
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 -> Suggestions 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