Version française
Home     About     Download     Resources     Contact us    
Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: ronniec95@l...
Subject:
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
is.

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


int main(int argc,char** argv)
{
	caml_startup(argv);
	callback(*caml_named_value("main"),Val_unit);
	return 0;
}
---------
This is main.ml

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
OCLINKFLAGS =
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 ${CAMLOBJECTS}
	rm -f ${INTERFACES}
	rm -f *.cmi
	rm -f *.cmo
	rm -f *.obj
	rm -f *~

${TARGET} : ${OBJECTS} ${INTERFACES} ${CAMLOBJECTS} camlprog.obj
	link  ${OBJECTS}  /OUT:${TARGET} ${LINKFLAGS}

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

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

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

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


Ronnie


-------------------
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