• Whats going on now

    From Nick Andre@1:229/426 to All on Sunday, November 13, 2005 17:01:59
    Hi...

    Okay, awhile ago I posted a question about adding Winsock support to program written in the anchient Borland Pascal 5.5.

    I managed to figure out that if I can call the WSOCKSQB library (that winsock library for QuickBASIC), I can do what I want to do.

    The WSOCKQB library comes with a standard Microsoft .LIB file, which I can then
    use LIB to extract an OBJ file from.

    But how do I call the procedures in the OBJ file from Pascal?

    For example, WSOCKSQB has a routine called WSINIT, which does nothing but return an integer and has no parameters to pass. How do I call that from Pascal?

    Any help is appreciated.

    *Nick*

    --- DB 1.96sl/100000
    * Origin: Nicks Notebook (1:229/426)
  • From Björn Felten@2:203/2 to Nick Andre on Monday, November 14, 2005 04:39:26
    For example, WSOCKSQB has a routine called WSINIT, which does nothing
    but return an integer and has no parameters to pass. How do I call that from Pascal?

    {$L WSOCKSQB.OBJ}
    function WSINIT:integer;near;external;

    begin
    writeln(WSINIT)
    end.


    Untested, from the top of my head, and I'm not sure if this worked with versions of TP older than BP7. You might have to change 'near' to 'far' if that's the way the object file is compiled.

    ---
    * Origin: news://felten.yi.org (2:203/2)
  • From Nick Andre@1:229/426 to Björn Felten on Monday, November 14, 2005 00:38:41
    For example, WSOCKSQB has a routine called WSINIT, which does
    nothing
    but return an integer and has no parameters to pass. How do I call
    that
    from Pascal?

    {$L WSOCKSQB.OBJ}
    function WSINIT:integer;near;external;
    begin
    writeln(WSINIT)
    end.

    Hi, I'm running Borland Pascal 5.5, unfortunately it doesn't work - it says BEGIN expected (I guess it doesn't interpret the NEAR or FAR statements), but upon changing, I'm getting errors about the PUBLIC calls in the OBJ file and when compiling the OBJ ahead of time using Microsoft Link, the problem is now an Invalid Integer or something along those lines.

    The WSOCKSQB library works perfectly on my QuickBASIC installation; so I know its not a problem with the library - just trying to figure out the proper way of interfacing BASIC libraries with Pascal. I know it can be done, just trying to figure out how...

    The WSOCKSQB library is open-source so I could always recompile it if necessary
    but I shouldn't have to do that.

    *Nick*

    --- DB 1.96sl/100000
    * Origin: Nicks Notebook (1:229/426)
  • From Björn Felten@2:203/2 to Nick Andre on Tuesday, November 15, 2005 00:55:21
    Hi, I'm running Borland Pascal 5.5, unfortunately it doesn't work

    Why don't you get BP7 then? It's readily available on the 'net, for instance
    at ftp://moonhe.jinr.ru/pub/pc/comp/bp7.zip.

    says BEGIN expected (I guess it doesn't interpret the NEAR or FAR statements),

    That may be correct. Try deleting the 'near' and see what happens.

    The WSOCKSQB library is open-source so I could always recompile it if necessary but I shouldn't have to do that.

    If you want to, you could send the source code to me, at bfelten (at) telia (dot) com, and I'll check it out for you.

    ---
    * Origin: news://felten.yi.org (2:203/2)
  • From Sean Dennis@1:18/200 to Björn Felten on Monday, November 14, 2005 20:19:08
    *** Quoting Björn Felten from a message to Nick Andre ***

    Why don't you get BP7 then? It's readily available on the 'net,
    for instance at ftp://moonhe.jinr.ru/pub/pc/comp/bp7.zip.

    Thanks-I'd been looking for BP7. :)

    Later,
    Sean

    // hausmaus@darktech.org | http://outpostbbs.net | ICQ: 19965647

    --- Telegard/2 v3.09.g2-sp4/mL
    * Origin: Outpost BBS - outpostbbs.darktech.org (1:18/200)
  • From Björn Felten@2:203/2 to Nick Andre on Friday, November 18, 2005 05:57:20

    but upon changing, I'm getting errors about the PUBLIC calls in the OBJ
    file

    Did you receive the fixes I sent you OK?

    What I did, was simply change the segment definitions in the ASM file to the
    macros .DATA and .CODE. Then I had to change all DSEG to @data, and finally, to
    play it safe, I changed 'MODEL large, basic' to MODEL large, pascal' to make sure all parameters were passed on properly.

    If you still have problems with your ASM sources, feel free to ask. This is what I've been doing for a living for some 25 years... :)

    ---
    * Origin: news://felten.yi.org (2:203/2)