digitalmars.D.learn - Moving from C to D
- bob (3/3) Jan 27 2009 im trying to convert my code from c to d and i have a question, how woul...
- bob (3/8) Jan 27 2009 sorry i copy wrong line. how do i do this line:
- BCS (5/11) Jan 27 2009 step 1 would be get the output from the preprocessor and take a look at ...
- BLS (8/24) Jan 28 2009 I think
- bob (2/30) Jan 28 2009
- Daniel Keep (10/40) Jan 28 2009 "in" means "pass argument by value," and is the default for arguments.
- BLS (6/54) Jan 28 2009 I am pretty sure that PASCAL means __pascal
- Daniel Keep (4/31) Jan 28 2009 Aah yes; I didn't realise Pascal was defined; I thought it was limited
im trying to convert my code from c to d and i have a question, how would i convert this line void notify ( struct dev_notify * ); thank you in advance
Jan 27 2009
sorry i copy wrong line. how do i do this line: int PASCAL FAR mycnt ( IN SOCKET s, IN const struct sockaddr FAR *name, IN int namelen ); bob Wrote:im trying to convert my code from c to d and i have a question, how would i convert this line void notify ( struct dev_notify * ); thank you in advance
Jan 27 2009
Reply to bob,sorry i copy wrong line. how do i do this line: int PASCAL FAR mycnt ( IN SOCKET s, IN const struct sockaddr FAR *name,IN int namelen );bob Wrote:step 1 would be get the output from the preprocessor and take a look at it. I'm guessing that PASCAL, FAR and IN are macros step 0 is try htod: http://www.digitalmars.com/d/1.0/htod.html
Jan 27 2009
BCS wrote:Reply to bob,I think int PASCAL FAR mycnt() becomes : extern (Pascal) int mycnt() The FAR* thingy seems to be a 16 bit relict... Guess the IN is not nessesary in D..., not sure though Bjoernsorry i copy wrong line. how do i do this line: int PASCAL FAR mycnt ( IN SOCKET s, IN const struct sockaddr FAR *name,IN int namelen );bob Wrote:step 1 would be get the output from the preprocessor and take a look at it. I'm guessing that PASCAL, FAR and IN are macros step 0 is try htod: http://www.digitalmars.com/d/1.0/htod.html
Jan 28 2009
do IN become in maybe? BLS Wrote:BCS wrote:Reply to bob,I think int PASCAL FAR mycnt() becomes : extern (Pascal) int mycnt() The FAR* thingy seems to be a 16 bit relict... Guess the IN is not nessesary in D..., not sure though Bjoernsorry i copy wrong line. how do i do this line: int PASCAL FAR mycnt ( IN SOCKET s, IN const struct sockaddr FAR *name,IN int namelen );bob Wrote:step 1 would be get the output from the preprocessor and take a look at it. I'm guessing that PASCAL, FAR and IN are macros step 0 is try htod: http://www.digitalmars.com/d/1.0/htod.html
Jan 28 2009
bob wrote:do IN become in maybe? BLS Wrote:"in" means "pass argument by value," and is the default for arguments. Also, I believe that PASCAL is the same as the Windows cc, so my guess at the conversion would be: For D 1.x: extern(Windows) int mycnt ( SOCKET s, sockaddr* name, int namelen ); For D 2.x: extern(Windows) int mycnt ( SOCKET s, const sockaddr* name, int namelen ); Note that you'd have to supply definitions of SOCKET and sockaddr. -- DanielBCS wrote:Reply to bob,I think int PASCAL FAR mycnt() becomes : extern (Pascal) int mycnt() The FAR* thingy seems to be a 16 bit relict... Guess the IN is not nessesary in D..., not sure though Bjoernsorry i copy wrong line. how do i do this line: int PASCAL FAR mycnt ( IN SOCKET s, IN const struct sockaddr FAR *name,IN int namelen );bob Wrote:step 1 would be get the output from the preprocessor and take a look at it. I'm guessing that PASCAL, FAR and IN are macros step 0 is try htod: http://www.digitalmars.com/d/1.0/htod.html
Jan 28 2009
Daniel Keep wrote:bob wrote:I am pretty sure that PASCAL means __pascal so the D1 translation is : extern (Pascal) int mycnt ( SOCKET s, sockaddr* name, int namelen ); See :http://www.digitalmars.com/d/1.0/htomodule.html at the bottom Bjoerndo IN become in maybe? BLS Wrote:"in" means "pass argument by value," and is the default for arguments. Also, I believe that PASCAL is the same as the Windows cc, so my guess at the conversion would be: For D 1.x: extern(Windows) int mycnt ( SOCKET s, sockaddr* name, int namelen ); For D 2.x: extern(Windows) int mycnt ( SOCKET s, const sockaddr* name, int namelen ); Note that you'd have to supply definitions of SOCKET and sockaddr. -- DanielBCS wrote:Reply to bob,I think int PASCAL FAR mycnt() becomes : extern (Pascal) int mycnt() The FAR* thingy seems to be a 16 bit relict... Guess the IN is not nessesary in D..., not sure though Bjoernsorry i copy wrong line. how do i do this line: int PASCAL FAR mycnt ( IN SOCKET s, IN const struct sockaddr FAR *name,IN int namelen );bob Wrote:step 1 would be get the output from the preprocessor and take a look at it. I'm guessing that PASCAL, FAR and IN are macros step 0 is try htod: http://www.digitalmars.com/d/1.0/htod.html
Jan 28 2009
BLS wrote:Daniel Keep wrote:Aah yes; I didn't realise Pascal was defined; I thought it was limited to C, D, Windows and System for D1, adding C++ for D2. -- Daniel[snip] Also, I believe that PASCAL is the same as the Windows cc, so my guess at the conversion would be: For D 1.x: extern(Windows) int mycnt ( SOCKET s, sockaddr* name, int namelen ); For D 2.x: extern(Windows) int mycnt ( SOCKET s, const sockaddr* name, int namelen ); Note that you'd have to supply definitions of SOCKET and sockaddr. -- DanielI am pretty sure that PASCAL means __pascal so the D1 translation is : extern (Pascal) int mycnt ( SOCKET s, sockaddr* name, int namelen ); See :http://www.digitalmars.com/d/1.0/htomodule.html at the bottom Bjoern
Jan 28 2009