* [Caml-list] ocamlmklib missing in win32 ?
@ 2002-08-21 21:17 PJ Durai
2002-08-26 13:22 ` Xavier Leroy
0 siblings, 1 reply; 3+ messages in thread
From: PJ Durai @ 2002-08-21 21:17 UTC (permalink / raw)
To: ocaml list
Hello
I had been trying to install some additional packages in my system.
My original intention was to install PXP. I am getting closer now. I have
managed PCRE (with some hints and files from Yutaka OIWA).
I needed to build (I think) the wlex - runtime to get PXP built.
But while building wlex broke because there is no ocamlmklib in my system.
Is there a way around this problem ?
cheers
pj
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] ocamlmklib missing in win32 ?
2002-08-21 21:17 [Caml-list] ocamlmklib missing in win32 ? PJ Durai
@ 2002-08-26 13:22 ` Xavier Leroy
2002-09-07 11:26 ` Dmitry Bely
0 siblings, 1 reply; 3+ messages in thread
From: Xavier Leroy @ 2002-08-26 13:22 UTC (permalink / raw)
To: PJ Durai; +Cc: ocaml list
> I had been trying to install some additional packages in my system.
> My original intention was to install PXP. I am getting closer now. I have
> managed PCRE (with some hints and files from Yutaka OIWA).
>
> I needed to build (I think) the wlex - runtime to get PXP built.
> But while building wlex broke because there is no ocamlmklib in my system.
Correct: ocamlmklib is only available under Unix (and Cygwin), but not
for the native Win32 port of OCaml.
The reason is as follows: ocamlmklib builds both a DLL and a static
library from a common set of C object files. This works fine under
Unix because (with the right compilation options) the same object
files can be used in both DLL and static contexts. But this isn't so
under Windows: object files for a DLL need to be compiled with
different, incompatible flags than object files for a static library.
Hence, the Windows Makefiles for a mixed OCaml/C library must be
written in such a way that C files are compiled twice, with the
correct flags, and the building of the DLL and of the static library
must be done by hand. To see how to proceed, refer to
otherlibs/*/Makefile.nt in the OCaml source distribution.
Sorry for the inconvenience, but once more Windows makes things more
complex than they really need to be :-)
- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] ocamlmklib missing in win32 ?
2002-08-26 13:22 ` Xavier Leroy
@ 2002-09-07 11:26 ` Dmitry Bely
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Bely @ 2002-09-07 11:26 UTC (permalink / raw)
To: caml-list
Xavier Leroy <xavier.leroy@inria.fr> writes:
>> I had been trying to install some additional packages in my system.
>> My original intention was to install PXP. I am getting closer now. I have
>> managed PCRE (with some hints and files from Yutaka OIWA).
>>
>> I needed to build (I think) the wlex - runtime to get PXP built.
>> But while building wlex broke because there is no ocamlmklib in my system.
>
> Correct: ocamlmklib is only available under Unix (and Cygwin), but not
> for the native Win32 port of OCaml.
>
> The reason is as follows: ocamlmklib builds both a DLL and a static
> library from a common set of C object files. This works fine under
> Unix because (with the right compilation options) the same object
> files can be used in both DLL and static contexts. But this isn't so
> under Windows: object files for a DLL need to be compiled with
> different, incompatible flags than object files for a static library.
IMHO that's wrong. /M* compiler flags specify which Microsoft runtime library our
compiled module (no matter dll, static lib, or standalone exe) will be
linked with. _DLL macro, that /MD also defines, is just intended for use in
Microsoft headers (they are slightly different for DLL-packaged
runtime). So you can build a DLL with /MT flag and using #if _DLL in misc.h
seems to not be very correct. As a solution that requires mininal changes,
but uses the same compiler flags for building both static and dynamic
libraries, I would suggest
[byterun/misc.h]
#if defined(_WIN32)
# if defined(_MSC_VER)
/* Supress the warning, generated by dllimport declaration */
/* and dllexport definition if both are present */
# pragma warning(disable: 4273)
# endif
# define CAMLexport __declspec(dllexport)
# define CAMLprim __declspec(dllexport)
# define CAMLextern __declspec(dllimport) extern
#else
# define CAMLexport
# define CAMLprim
# define CAMLextern extern
#endif
[byterun/custom.c]
replace CAMLextern with CAMLexport in function definitions (looks like a
bug)
[config/Makefile]
BYTECCCOMPOPTS=/Ox /MD
BYTECCLINKOPTS=$(BYTECCCOMPOPTS)
DLLCCCOMPOPTS=$(BYTECCCOMPOPTS)
NATIVECCCOMPOPTS=$(BYTECCCOMPOPTS)
NATIVECCLINKOPTS=$(NATIVECCCOMPOPTS)
It works -- I have just done "make -f Makefile.nt clean world opt bootstrap".
> Hence, the Windows Makefiles for a mixed OCaml/C library must be
> written in such a way that C files are compiled twice, with the
> correct flags, and the building of the DLL and of the static library
> must be done by hand. To see how to proceed, refer to
> otherlibs/*/Makefile.nt in the OCaml source distribution.
>
> Sorry for the inconvenience, but once more Windows makes things more
> complex than they really need to be :-)
- Dmitry Bely
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-09-07 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-21 21:17 [Caml-list] ocamlmklib missing in win32 ? PJ Durai
2002-08-26 13:22 ` Xavier Leroy
2002-09-07 11:26 ` Dmitry Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).