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 

character* in .Net

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





PostPosted: Mon Mar 06, 2006 2:30 am    Post subject: character* in .Net Reply with quote

I am trying to invoke the following subroutine from C#
I supposed that character* is automatically converted into String as real* is converted into Double, however
it doesn't work as expected. What did I wrong?


!*-------------------------------------------------------------------------
!* revbuf -- reverse the order of the contents of a buffer
!*-------------------------------------------------------------------------
subroutine REVBUF (buf)
character*20 buf
character*1 temp
integer*4 width,data_width
! character*20 dll_export :: REVBUF
! ASSEMBLY_INTERFACE(NAME="REVBUF")
width = len(buf)
data_width = index (buf,char(0))
!c----------------------------------------------------------------------
!c We pad the string with blanks on the end because osl passes the
!c string with binary 0 at the end of the data within the field.
!c Note: data_width will be 0 if the string fills the field.
!c----------------------------------------------------------------------
if (data_width .ne. 0) then
buf(data_width:width) = ' '
end if
j = width
do i = 1 , j/2
temp = buf(i:i)
buf(i:i) = buf(j:j)
buf(j:j) = temp
j=j-1
end do
do i = 1 , width
if (buf(i:i) .eq. '(') then
buf(i:i) = ')'
else if (buf(i:i) .eq. ')') then
buf(i:i) = '('
else if (buf(i:i) .eq. '[') then
buf(i:i) = ']'
else if (buf(i:i) .eq. ']') then
buf(i:i) = '['
else if (buf(i:i) .eq. '{') then
buf(i:i) = '}'
else if (buf(i:i) .eq. '}') then
buf(i:i) = '{'
else if (buf(i:i) .eq. '<') then
buf(i:i) = '>'
else if (buf(i:i) .eq. '>') then
buf(i:i) = '<'
end if
end do
return
end


Boris Gilad
Back to top
PaulLaidler
Site Admin


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

PostPosted: Mon Mar 06, 2006 10:07 am    Post subject: character* in .Net Reply with quote

Boris

Please see "Calling Fortran from other .NET languages" in the help file where it says...

"Fortran CHARACTERs are mapped to System.String objects and passed by value (this means that changes made to a dummy argument are not passed back to the actual argument at the point of call)."

In other words, you can make the call and do the changes but they will not be reflected back to the point of call.

My first thought is that the simplest approach may be to write this part of the code in C#.





Back to top
View user's profile Send private message AIM Address
Anonymous
Guest





PostPosted: Tue Mar 07, 2006 12:22 am    Post subject: character* in .Net Reply with quote

Paul,

Thanks for the prompt answer.
Back to top
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