Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-10-23 (08:31)
From: ronniec95@l...
Compiling native binaries on win32.

Though I'm not guaranteeing anything. I got the following to work for my
project but you'll need to make relevant changes.

It's an interface to a proprietary messaging system which is what talarian_intf.cpp

This is main.cpp
#include <caml/mlvalues.h>
#include <caml/callback.h>
#include <stdio.h>

int main(int argc,char** argv)
	return 0;
This is

let main () = print_string "Hello World"

let _ = 
    Callback.register "main" main

this is the makefile

OCAML = ocamlopt
CC = cl /MT /Ox
OFLAGS = -c -output-obj
OBJECTS = talarian_intf.obj cppmain.obj
CAMLOBJECTS = main.cmx
INTERFACES = Talarian.cmi
LIBPATH=-LIBPATH:e:/Local/"Objective Caml"/lib \
		-LIBPATH:C:/"Program Files"/Talarian/ss62/lib/i86_w32 \
		-LIBPATH:C:/"Program Files"/"Microsoft Visual Studio"/VC98/LIB \
		-LIBPATH:C:/"Program Files"/"Microsoft Visual Studio"/VC98/MFC/LIB \
      	-LIBPATH:C:/"Program Files"/"Microsoft Visual Studio"/VC98/ATL/LIB

INCLUDE=-IE:/Local/"Objective Caml"/lib \
		-IC:/"Program Files"/Talarian/ss62/include \
		-IC:/"Program Files"/"Microsoft Visual Studio"/VC98/INCLUDE \
		-IC:/"Program Files"/"Microsoft Visual Studio"/VC98/MFC/INCLUDE \
		-IC:/"Program Files"/"Microsoft Visual Studio"/VC98/ATL/INCLUDE \

LINKFLAGS =  ${LIBPATH} E:/Local/"Objective Caml"/lib/std_exit.obj stdlib.lib
tipc.lib tutil.lib libasmrun.lib libunix.lib advapi32.lib wsock32.lib camlprog.obj
/NOLOGO /subsystem:console /machine:I386
TARGET = go.exe

all : ${TARGET}

clean :
	rm -f ${INTERFACES}
	rm -f *.cmi
	rm -f *.cmo
	rm -f *.obj
	rm -f *~


camlprog.obj : ${CAMLOBJECTS}
	${OCAML} -output-obj -o camlprog.obj unix.cmxa ${CAMLOBJECTS}

%.cmx :
	${OCAML} ${OFLAGS} $<

%.cmi : %.mli
	${OCAML} -c $<

%.obj : %.c
	${CC} ${INCLUDE} -c $<


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: