[racket] Cross-compilation

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Sun Jul 24 00:42:27 EDT 2011

> OK. Here's the code to my main module:
>
> #lang racket
> ;#lang racket/gui
>
> (require racket/gui)
>
> ;(rename-in srfi/48 (format some-other-name))
> ; [13:31] <DT``> or (except-out racket/base format)
> (require (rename-in srfi/48 (format format48)))
>
> (require carali/misc)
>
> (require fiqua/about)
>
>
> ; Make a frame by instantiating the frame% class
> (define my-frame (new frame% [label "Fiqua - Financial Quant"]))
>
>
> ;;; menu
> (define menu-bar (new menu-bar% [parent my-frame]))
> (define main-menu (new menu% [label "Main Menu"] [parent menu-bar]))
> (define help-menu (new menu% [label "Help"] [parent menu-bar]))
> (define menu-about (new menu-item% [label "About"] [parent help-menu]
>                         [callback (lambda (i e) (show-about-box my-frame))]))
>
>
>
> ;;; input parameters
>
> (define (make-param the-label cb)
>   (let ((hp (new horizontal-pane% [parent my-frame])))
>     (new message% [label the-label] [parent hp] [min-width 100])
>     (new text-field% [parent hp] [label ""] [min-width 100] [callback cb]))
>   (void))
>
> (define-simple-syntax (make-callback var)
>   (lambda (i e)
>     (set! var (catch-errors #f (string->number (send i get-value))))))
>
> (define-simple-syntax (def-param var label)
>   (define var #f)
>   (make-param label (make-callback var)))
>
>
> ;(define ta (make-param "Total Assets"))
> (def-param rev "Revenue")
> (def-param ebit "EBIT")
> (def-param ca "Current Assets")
> (def-param ta "Total Assets")
> (def-param cl "Current Liabilities")
> (def-param tl "Total Liabilities")
> ;(def-param wc "Working Capital")
> (def-param re "Accumulated retained earnings")
> (def-param mc "Market Cap")
> (define zones (new message% [parent my-frame] [label "z <1.1 = Danger . z>2.6 = Healthy. Grey otherwise"]))
> (define z-text (new message% [parent my-frame] [label "z-score: ??"] [min-width 200]))
>
> (define (wc) (- ca cl))
>
>
> (define (calculate-z fld ev)
>   (define z-score (catch-errors "Invalid Input"
>                               (let* ((x1 (/ (wc) ta))
>                                      (x2 (/ re ta))
>                                      (x3 (/ ebit ta))
>                                      (x4 (/ mc tl))
>                                      (z (+ (* 6.56 x1) (* 3.26 x2) (* 6.72 x3) (* 1.05 x4))))
>                                 (format48 "~4,1F" z))))
>   (set! z-score (format48 "z-score: ~a" z-score))
>   (send z-text set-label z-score))
>
>
>
>
> ;;; calculate button
> (define my-button (new button% [parent my-frame]
>                        [label "Calculate"]
>                        ; Callback procedure for a button click:
>                        (callback calculate-z)))
>
>
> ; Show the frame by calling its show method
> (send my-frame show #t)
>
>
>
> There's some other files involved. I open it in DrRacket.
> 1. Select menu item Racket > Create Executable
> 2. Browse for a (zip) filename on my desktop, which is not where my source is
> 3. Select Type: Distribution (to install on other machines)
> 4. Select Base: GRacket
> 5. Click button Create
>
> A zip file is created for the application. I can unzip it, and run the executable therein. Everthying works fine on Win 7, where it was compiled. If I try to run it on XP SP1, I get:
> fiqua.exe - Entry Point Not Found
> The procedure entry point DecodePointer could not be located in the dynamic link library KERNEL32.dll
>
> Other people report problems with trying to run it on their XP machines. Vista too.

I created an executable on Win7 with racket 5.1.2.3 following the
indicated steps and using the given code (I had to comment out some
stuff because I dont have the required files), and I was able to run
it on win xp (sp2) as well. So I guess the problem may be in the
required files or might I suggest trying one of the nightly builds?



Posted on the users mailing list.