chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Problem with Chicken +wxwindows


From: Mark Baily
Subject: [Chicken-users] Problem with Chicken +wxwindows
Date: Fri, 15 Apr 2005 19:21:07 +1000

Hello I am trying to _embed_ chicken generated code into a wxWindows app
running on Win32.

First I get a freshly compiled distrib of wxWindows-2.4.2 (compiled with
Release DLL) and alter the grid.cpp sample application in the samples/ dir,
to include chicken headers etc.

Then I compile chicken but first change all the command lines running cl.exe
in vcbuild.bat to do cl /MD so they use the multhreaded DLL version of the
c runtime libs (the same as the wxWindows app will use).

Then I make a scheme test file called funcs.scm. I compile it to c using
chicken and the add it to the visual studio project.

Then I add libchicken.lib and libstuffed-chicken.lib to the linker dependencies
in the vs project and also add C_EMBEDDED to the C preprocessor definitions.
Also add the chicken directory to the "include" and "library" directories
in the tools->customize menu in Visual Studio.

Then I copy the *.dll from the chicken directory the ReleaseDLL/ dir in the
grid sample wxWindows application.

Then I try to run the application, grid.exe, it just exits whenever
test_chicken() is called. In another wxWindows application I am trying to embed
chicken in (VTBuilder from the open source Virtual Terrain Project) it
sometimes crashes.

--------------------------------------------------------------------------
Here is funcs.scm:
--------------------------------------------------------------------------
(include "chicken-entry-points")

(define-embedded (test_chicken (int x)) int
 (define outf (open-output-file "chickenout.txt"))
  (write "hello" outf) (newline outf)
   (close outf)
    (* x x))


--------------------------------------------------------------------------
Here is grid.cpp, with the first bit altered from the grid.cpp sample
in the wxWindows-2.4.2 distrib:
--------------------------------------------------------------------------

/*
 * File:    grid.cpp
 * Purpose: wxGrid test

 PLEASE NOTE: this sample is deprecated. See
 newgrid for a sample based on the newer wxGrid API.

 * Author:  Julian Smart
 * Created: 1995
 * Updated:
 * Copyright:   (c) 1995, AIAI, University of Edinburgh
 */
extern "C" {
#include "chicken.h"
        int test_chicken(int);
}

int init_chicken(void)
{
        CHICKEN_initialize(0,0,0,C_toplevel);
        test_chicken(3);
        return 0;
}

int i = init_chicken();

static const char sccsid[] = "%W% %G%";

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]