In this Windows build this error:

[lookup_name_in_env]: Name 'fd_t' not found in environment (depth 2)
In C:\project\github\felix\build\release\tools\webserver.flx: line 15, cols 26 
to 29
14: 
15: open TerminalIByteStream[fd_t];


opens up a can of worms I've been avoiding for a while ;(

We have multiple "file types" and its a mess. 

First, "posix_file" is an "int" and is supported on both Unix and
Windows. However the Windows functionality is limited.
Posix also uses "int" for sockets. WIndows doesn't.

Windows native filetypes are 

WFILE = HANDLE
SOCKET = SOCKET

SOCKET is mandatory for sockets on Windows. WFILE is required
for the advanced functionality provided by Windows: posix_file is
provided by the MS C library for Posix compatibility but the support
is weak. We're using that at the moment just to get things moving.

In principle


        fd_t -- is posix-file on posix and WFILE on Windows (HANDLE)
        socket_t -- is posix-file (int) on posix and SOCKET on windows

The platform specific functions should NOT use these abstractions.
Recall .. we want to write windows code on Linux. The Felix compiler
should still wortk -- the generated C++ can't be compiled but it can
be shipped to a windows box and compiled.

So the fd_t, socket_t bindings are only to be used for "current host"
platform. This means you cannot call platform specific functions on these
types. Instead, we use type classes, and instantiate for both
windows and posix, and you must call using the type class functions.

This will switch to windows when on windows so the same Felix
code will work.

you can override the host setting by using qualified names 
with the class set to the desired platform eg something like: 

        FileSystem[WFILE]
        Faio[SOCKET]

would bind to the windows versions and generate windows code
on all platforms (including Linux).

The calls still go through the abstraction layer this way: the
functions are still platform independent.

A complication is that Windows provides two file types!
WFILE (HANDLE) and posix-file (int).

Actually there are many more:

        C streams = FILE*
        C++ streams = A big MESS of inheritance

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to