Compiling drivers with MinGW?

Bjorn Gustavsson bjorn@REDACTED
Tue Sep 9 13:57:27 CEST 2003


"Michael Hobbs" <michael@REDACTED> writes:

> Has anyone been able to create a driver DLL using MinGW? The problem that
> I'm running into is that the libraries in $ERL_TOP/lib/erl_interface/lib
> are in MSVC format. Has anyone been able to either:
> 
> a) Convert the .lib's to GCC-compliant .a's?
> b) Compile the erl_interface source using MinGW?
> 
> I suppose as a last resort, I could change the erl_interface build to
> generate a DLL instead of static libraries, but that would be less than
> optimal.
> 
> Any help is greatly appreciated. Thanks,
> - Michael Hobbs
> 
> 
> 

Answer from Patrik Nyblom:

Compiling drivers with MinGW requires a small patch to the header file in
R9C, which will be included in our next release. However erl_interface is
a completely other thing. It needs some rewriting to work with mingw, of
which one is to generate a DLL as an alternative to the static libraries.
You said a DLL is less than optimal, I don't really understand why, DLL's
are far more flexible than static libraries and ought to be the way to
proceed in anyway. As a nice bi-product of using shared libraries, the
erl_interface libraries can be used by any compiler. If one chooses .a or
.lib files for the import library is then a matter of taste. MinGW can
handle either.

The free esdl library for erlang uses MinGW to compile, in fact it patches
the said header in the makefiles (to a temp directory). It haowever does
not use erl_interface for encoding/decoding, a handwritten protocol
between erlang and the driver is far more efficient. It can also be said
that another free library, erlgtk, which uses erl_interface has to be
compiled with VC++.

So, the MinGW comatibility is a problem, abd as far as I know, the DLL
solution is the most feasible. In it's current state, erl_interface cannot
even be recompiled using MinGW, it uses microsoft specific directives that
MinGW has not implemented.

If all goes well, the next windows-release (R9C-1) will contain a
erl_interface working wint MinGW as well, but no promises yet :-)

/Patrik, OTP

-- 
Björn Gustavsson            Ericsson Utvecklings AB
bjorn@REDACTED      ÄT2/UAB/F/P
			    BOX 1505
+46 8 727 56 87 	    125 25 Älvsjö



More information about the erlang-questions mailing list