add ".def" generation for MSVC build
This commit is contained in:
parent
ea6cef5246
commit
a38ba440fa
|
@ -63,3 +63,6 @@ if errorlevel 1 exit /B 1
|
|||
|
||||
..\..\racket -G %BUILD_CONFIG% -N "raco" %SELF_RACKET_FLAGS% -l- setup %PLT_SETUP_OPTIONS%
|
||||
if errorlevel 1 exit /B 1
|
||||
|
||||
..\..\racket -G ..\%BUILD_CONFIG% -u gendef.rkt
|
||||
if errorlevel 1 exit /B 1
|
||||
|
|
30
racket/src/worksp/gendef.rkt
Normal file
30
racket/src/worksp/gendef.rkt
Normal file
|
@ -0,0 +1,30 @@
|
|||
;; Generate ".def" files for installed DLLs
|
||||
#lang racket/base
|
||||
(require racket/system)
|
||||
|
||||
(define lib-dir (build-path 'up 'up "lib"))
|
||||
|
||||
(define (gen-one name)
|
||||
(define f (build-path lib-dir (format "~axxxxxxx.dll" name)))
|
||||
(when (file-exists? f)
|
||||
(define s (open-output-bytes))
|
||||
(parameterize ([current-output-port s])
|
||||
(system (format "dumpbin /exports ~a" f)))
|
||||
(define i (open-input-bytes (get-output-bytes s)))
|
||||
(regexp-match #rx"ordinal +hint +RVA +name" i)
|
||||
(call-with-output-file*
|
||||
(build-path lib-dir (format "~axxxxxxx.def" name))
|
||||
#:exists 'truncate
|
||||
(lambda (o)
|
||||
(fprintf o "EXPORTS\n")
|
||||
(for ([l (in-lines i)])
|
||||
(define m (regexp-match
|
||||
#rx"([0-9]+) +(?:[0-9A-Fa-f]+) +(?:[0-9A-Fa-f]+) +([_A-Za-z][_A-Za-z0-9]*) +="
|
||||
l))
|
||||
(when m
|
||||
(fprintf o " ~a @~a\n" (caddr m) (cadr m))))))))
|
||||
|
||||
(gen-one "libmzgc")
|
||||
(gen-one "libracket")
|
||||
(gen-one "libracket3m")
|
||||
|
Loading…
Reference in New Issue
Block a user