- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
We have a third party dll written in VC++.The arguments that a particular subroutine takes are given as word,long,integer in VC++.When we are assigning the datatypes for word as integer(2), for long as integer(4) and integer for integer in our interface ,it does not give any mismatch error,but it also does not result in correct execution. We are unsure of what the equivalent datatypes are in Visual Fortran for word,long,integer.Could you please help us.
-rs
We have a third party dll written in VC++.The arguments that a particular subroutine takes are given as word,long,integer in VC++.When we are assigning the datatypes for word as integer(2), for long as integer(4) and integer for integer in our interface ,it does not give any mismatch error,but it also does not result in correct execution. We are unsure of what the equivalent datatypes are in Visual Fortran for word,long,integer.Could you please help us.
-rs
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
int and long are both 32 bit integers in VC++, so integer(4) should match for those.
If word means unsigned short, you'll have to find a workaround, since fortran does not have 'unsigned integers'. If you've got VC++, perhaps you could write a wrapper between fortran and the dll, and handle the assignment from integer(4) <-> int <-> ushort (dll arg) from there. Search comp.lang.fortran on Google for some more alternatives for handling unsigned data types.
If word means unsigned short, you'll have to find a workaround, since fortran does not have 'unsigned integers'. If you've got VC++, perhaps you could write a wrapper between fortran and the dll, and handle the assignment from integer(4) <-> int <-> ushort (dll arg) from there. Search comp.lang.fortran on Google for some more alternatives for handling unsigned data types.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use integer(2) as replacement for word as long as you take care you don't mess with the most significant bit which determines the sign; in other words, if your integer(2) variable is less than 32767. Even if it is, you might play with TRANSFER intrinsic (untested):
should result that iWord contains identical bit-representation as C's unsigned int 40000, meaning that C would "see" it as 40000 (though you'd see it in debugger as something like -7232).
HTH
Jugoslav
integer(2):: iWord iWord=TRANSFER(40000_4, iWord)
should result that iWord contains identical bit-representation as C's unsigned int 40000, meaning that C would "see" it as 40000 (though you'd see it in debugger as something like -7232).
HTH
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page