[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hello World extension in MSVC++ 6.0



Thanks to Paul Steckler and Matthew Flatt, I eventually got the Hello World 
extension program working with MSVC++ 6.0. I've written a few notes to help 
anyone else doing this.

1. Create the following source file and call it hello.c:


	#include "escheme.h"


	// 'Hello World' code from 'Writing MzScheme Extensions'


	Scheme_Object *scheme_initialize(Scheme_Env *env)
	{
		return scheme_make_string("Hello World!");
	}

	Scheme_Object *scheme_reload(Scheme_Env *env)
	{
		return scheme_initialize(env);	// Nothing special for reload
	}


2. Get a Windoze DOS prompt.

3. Go into directory ~\Microsoft Visual Studio\VC98\bin and type

	VCVARS32

This executes a batch file that sets up the MSVC++ environment, etc.

4. Go to where your extension source file is saved and type

	mzc --cc hello.c

to compile your program. Object file hello.obj is generated.

5. Type

	mzx --ld hello.dll hello.obj

to link the object file. File hello.dll is generated.

6. Start MzScheme and enter

	(load-extension "~\\hello.dll") in the upper window.

You'll need to insert the full path to your extension file.

7. Click on the 'Execute' button. You should see 'Hello World!'
displayed in the lower window.


Leon
--
Leon Heller, G1HSM Tel: +44 1327 359058 Email:leon_heller@hotmail.com
My web page: http://www.geocities.com/leon_heller
My low-cost Altera Flex design kit: http://www.leonheller.com


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp