SocketTools and Other Languages

One of the questions that we often get about the SocketTools Library Edition is about support for C/C++ compilers and languages aside from Visual C++ and Visual Basic. As a collection of standard dynamic link libraries (DLLs), SocketTools can be used by virtually any programming language available for the Windows platform. The documentation is primarily focused around C++ development because that’s what the majority of developers who use the Library Edition are working with, but it’s by no means limited to just Microsoft’s compilers. As long as your favorite language is capable of calling functions in the Windows API, you can use the SocketTools Library Edition.

When we designed the API for SocketTools, we wanted to make it as similar to the Windows API, with similar function naming conventions and using only common data types and simple structures whenever possible. For example, instead of passing around pointers to complex context structures as some APIs do, all of the SocketTools functions using handles. We explicitly avoided using certain C/C++ constructs like unions, and use common scalar types (integers, characters, etc.) for most parameters and structure members. The goal was to make the API simple to use, reducing the overall learning curve and make it easy to use in other languages that may not have the same kind of language features that C/C++ does. For that same reason, the SocketTools Library Edition DLLs are not ActiveX DLLs that require the use of COM. However, we do include an embedded type library as a resource in the DLL that allows it to be directly referenced by Visual Basic (this makes things easier for VB6 developers who prefer to use DLLs rather than ActiveX controls).

If you’re interested in using SocketTools with a non-Microsoft C/C++ compiler, it should be fairly easy to use the libraries, particularly if the compiler supports the most common Microsoft extensions. The C++ classes do not require the use of MFC or ATL, however if exists, they will take advantage of it. We include import libraries in both COFF and OMF formats; while most compilers today use COFF, the Borland C++ compilers continue to use OMF, so you would need to link against those libraries.

For languages other than C/C++, we also provide constant and function declarations for Visual Basic 6.0, PowerBASIC, and Delphi. We also include P/Invoke declarations for Visual Basic .NET and C#. For languages that aren’t directly supported, usually the function declarations for one of these languages can get you started.

It definitely helps if you have at least a cursory understanding of ANSI C and the common data types that are used. If your programming language has documentation on how to call functions in the Windows API, you can also use that as a resource to learn what needs to be done for SocketTools. For example, if you need to know how your language handles passing a null-terminated string to a function, look at how you would call the GetFileAttributes function in your language. If you need to know how to pass a string buffer to a function that changes its value, check how you would call the GetCurrentDirectory function.

Of course, if you have any questions you can join our technical support forums and we’ll be happy to help. We may not have experience with the particular language that you’re using, but we can still provide guidance on what the SocketTools function expects and offer suggestions as to how you can get your program working.

Share This
Facebooktwittergoogle_plus