Re: [racket-dev] unable to embed racket in a C++ program
Ok, that gets me past the missing collection exception. Now it crashes inside libracket3m_8bh1a8.dll. Here's the callstack... this is the stock 5.3 distribution so a stock map file may help: libracket3m_8bh1a8.dll!0f548983() [Frames below may be incorrect and/or missing, no symbols loaded for libracket3m_8bh1a8.dll] libracket3m_8bh1a8.dll!0f549ad1() libracket3m_8bh1a8.dll!0f6c5a34() libracket3m_8bh1a8.dll!0f6c5ab0() libracket3m_8bh1a8.dll!0f751e2f() libracket3m_8bh1a8.dll!0f751f6a() libracket3m_8bh1a8.dll!0f6e5675() libracket3m_8bh1a8.dll!0f5bea15() libracket3m_8bh1a8.dll!0f6bfd95() libracket3m_8bh1a8.dll!0f5c0028() libracket3m_8bh1a8.dll!0f5c03fe() libracket3m_8bh1a8.dll!0f5cb32e() libracket3m_8bh1a8.dll!0f66095f() libracket3m_8bh1a8.dll!0f660c4e() libracket3m_8bh1a8.dll!0f66cd83() libracket3m_8bh1a8.dll!0f66d146() libracket3m_8bh1a8.dll!0f642566() libracket3m_8bh1a8.dll!0f657a93() libracket3m_8bh1a8.dll!0f666cc9() libracket3m_8bh1a8.dll!0f66a2a7() libracket3m_8bh1a8.dll!0f66affd() libracket3m_8bh1a8.dll!0f66b0d2() dctest.exe!run(Scheme_Env * e, int argc, char * * argv) Line 48 + 0xc bytes C++ libracket3m_8bh1a8.dll!0f55baa3() libracket3m_8bh1a8.dll!0f55d9a5() libracket3m_8bh1a8.dll!0f55da46() libracket3m_8bh1a8.dll!0f55df3a() dctest.exe!main(int argc, char * * argv) Line 58 + 0x17 bytes C++ dctest.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C dctest.exe!mainCRTStartup() Line 371 C kernel32.dll!75b1339a() ntdll.dll!771d9ef2() ntdll.dll!771d9ec5() I changed the code to register all Scheme_Objects in the collector, but same result... Thanks, Dan On Sat, Sep 22, 2012 at 6:04 AM, Matthew Flatt mfl...@cs.utah.edu wrote: The %RACKETDIR% in scheme_make_path() isn't going to get expanded as an environment variable. You'll have to use getenv() directly: a[0] = scheme_make_path(getenv(RACKETDIR)); a[1] = scheme_make_path(collects); Scheme_Object * collectPath = scheme_build_path(2, a); Scheme_Object * collectPathList = scheme_build_list(1, collectPath); scheme_init_collection_paths(e, collectPathList); At Fri, 21 Sep 2012 16:42:23 -0700, Dan Liebgold wrote: I'm having a terrible time trying to embed Racket 5.3 in a C++ program. Please take a look at https://gist.github.com/3764529 and tell me where I'm going wrong. This is the output I get: racket/base: standard-module-name-resolver: collection not found collection: racket in collection directories: C:\Users\danl\AppData\Roaming\Racket\5.3\collects in: racket/base context...: standard-module-name-resolver RACKETDIR environment variable is defined properly (and not to the path in the output.) Any ideas? -- Dan Liebgold[dan.liebg...@gmail.com] _ Racket Developers list: http://lists.racket-lang.org/dev -- Dan Liebgold[dan.liebg...@gmail.com] _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] unable to embed racket in a C++ program
Eh, scratch that last crash. My erroneous book-keeping with registered locals. Carry on... On Mon, Sep 24, 2012 at 9:58 AM, Dan Liebgold dan.liebg...@gmail.comwrote: Ok, that gets me past the missing collection exception. Now it crashes inside libracket3m_8bh1a8.dll. Here's the callstack... this is the stock 5.3 distribution so a stock map file may help: libracket3m_8bh1a8.dll!0f548983() [Frames below may be incorrect and/or missing, no symbols loaded for libracket3m_8bh1a8.dll] libracket3m_8bh1a8.dll!0f549ad1() libracket3m_8bh1a8.dll!0f6c5a34() libracket3m_8bh1a8.dll!0f6c5ab0() libracket3m_8bh1a8.dll!0f751e2f() libracket3m_8bh1a8.dll!0f751f6a() libracket3m_8bh1a8.dll!0f6e5675() libracket3m_8bh1a8.dll!0f5bea15() libracket3m_8bh1a8.dll!0f6bfd95() libracket3m_8bh1a8.dll!0f5c0028() libracket3m_8bh1a8.dll!0f5c03fe() libracket3m_8bh1a8.dll!0f5cb32e() libracket3m_8bh1a8.dll!0f66095f() libracket3m_8bh1a8.dll!0f660c4e() libracket3m_8bh1a8.dll!0f66cd83() libracket3m_8bh1a8.dll!0f66d146() libracket3m_8bh1a8.dll!0f642566() libracket3m_8bh1a8.dll!0f657a93() libracket3m_8bh1a8.dll!0f666cc9() libracket3m_8bh1a8.dll!0f66a2a7() libracket3m_8bh1a8.dll!0f66affd() libracket3m_8bh1a8.dll!0f66b0d2() dctest.exe!run(Scheme_Env * e, int argc, char * * argv) Line 48 + 0xc bytes C++ libracket3m_8bh1a8.dll!0f55baa3() libracket3m_8bh1a8.dll!0f55d9a5() libracket3m_8bh1a8.dll!0f55da46() libracket3m_8bh1a8.dll!0f55df3a() dctest.exe!main(int argc, char * * argv) Line 58 + 0x17 bytes C++ dctest.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C dctest.exe!mainCRTStartup() Line 371 C kernel32.dll!75b1339a() ntdll.dll!771d9ef2() ntdll.dll!771d9ec5() I changed the code to register all Scheme_Objects in the collector, but same result... Thanks, Dan On Sat, Sep 22, 2012 at 6:04 AM, Matthew Flatt mfl...@cs.utah.edu wrote: The %RACKETDIR% in scheme_make_path() isn't going to get expanded as an environment variable. You'll have to use getenv() directly: a[0] = scheme_make_path(getenv(RACKETDIR)); a[1] = scheme_make_path(collects); Scheme_Object * collectPath = scheme_build_path(2, a); Scheme_Object * collectPathList = scheme_build_list(1, collectPath); scheme_init_collection_paths(e, collectPathList); At Fri, 21 Sep 2012 16:42:23 -0700, Dan Liebgold wrote: I'm having a terrible time trying to embed Racket 5.3 in a C++ program. Please take a look at https://gist.github.com/3764529 and tell me where I'm going wrong. This is the output I get: racket/base: standard-module-name-resolver: collection not found collection: racket in collection directories: C:\Users\danl\AppData\Roaming\Racket\5.3\collects in: racket/base context...: standard-module-name-resolver RACKETDIR environment variable is defined properly (and not to the path in the output.) Any ideas? -- Dan Liebgold[dan.liebg...@gmail.com] _ Racket Developers list: http://lists.racket-lang.org/dev -- Dan Liebgold[dan.liebg...@gmail.com] -- Dan Liebgold[dan.liebg...@gmail.com] _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] embedding racket without overriding main?
Does anyone have an example of embedding 3m Racket (5.3) in a C++ program without overriding main? I have a legacy C++ app that wants to eval some Racket code but I'd like to be minimally invasive. Might need to shell out... -- Dan Liebgold[dan.liebg...@gmail.com] _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] Dracula development
Short, short version: I will be working on a new Dracula implementation; see https://github.com/carl-eastlund/dracula (currently just a bare Racket fork). Short version: While the new Dracula is still spiritually ACL2 via Racket, the new one will be very different from the old. It will be much more Rackety, have full use of Racket macros and modules, and have a much improved component system based very closely on ML functors. It will also be distributed as a regular collection rather than as a planet package. Along with Dracula development, I will spin off some of my support libraries as new collections (or parts of existing ones). TL;DR: The implementation of my thesis is almost ready for prime-time. I want to push it out to the world soon. I have not found Planet to be an ideal platform for an internal PLT developer trying to keep up with the development branch; I need to update my code far too often, and yet for clients I have to maintain compatibility with the released version. I could probably resolve that if I wanted to maintain stable and release branches of my own project; I do not. Our organization has a whole development and release infrastructure built around our core repository, and it has not been beneficial for me to work outside that for so long. In the meantime, my private Dracula development has built up a number of support libraries. Some of them are superfluous and should just basically be inlined into the implementation, but some are also near-ready for release in their own right. The top candidates are my debugging library, which is in the spirit of unstable/debug but significantly improved, and my pretty-printer which has a number of advantages over racket/pretty. I have found both of these to be immensely useful in debugging programs with little errors buried under huge amounts of data. I don't know if the unstable collection will be part of the life cycle for these collections; I've yet to pin down the best way to use unstable so it doesn't just turn into a code graveyard. Probably these collections are better candidates than some of my previous attempts, in that I am actively developing them for a specific purpose and intend to push them out as stable collections before long. In previous cases, I was just putting stuff out there and seeing what happens. The old Dracula was a Racket model of ACL2: taking ACL2 programs, and simulating them in DrRacket so we could get the world teachpack and syntax checking. The new Racket is an ACL2 model of Racket, designed to be much more along the lines of taking first- (and possibly second-)order Racket programs and certifying ACL2 models of them. I don't know how precise that will be; the new ML-like components don't look much like anything we have natively in Racket. Anyway, the repository is up on Github, linked above. Right now it's just a copy of plt/racket, but I'll be gradually pulling pieces of my private Dracula repo (which for various reasons I prefer to refactor into the Racket fork piecemeal rather than copy wholesale). Carl Eastlund _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] embedding racket without overriding main?
At Mon, 24 Sep 2012 15:10:08 -0700, Dan Liebgold wrote: Does anyone have an example of embedding 3m Racket (5.3) in a C++ program without overriding main? I have a legacy C++ app that wants to eval some Racket code but I'd like to be minimally invasive. Might need to shell out... One strategy is to start a separate OS-level thread for Racket. The rest of the C++ program would send expressions to the Racket thread evaluation via a pipe or some kind of semaphore-based communication. On Windows, you could also try using MzCOM, which is sort of half-way between managing your own thread and starting a separate process. _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] embedding racket without overriding main?
Is there any reason the scheme_main_setup trampoline can't be done later in the program (i.e. only at the point I want to invoke Racket stuff)? On Mon, Sep 24, 2012 at 5:09 PM, Matthew Flatt mfl...@cs.utah.edu wrote: At Mon, 24 Sep 2012 15:10:08 -0700, Dan Liebgold wrote: Does anyone have an example of embedding 3m Racket (5.3) in a C++ program without overriding main? I have a legacy C++ app that wants to eval some Racket code but I'd like to be minimally invasive. Might need to shell out... One strategy is to start a separate OS-level thread for Racket. The rest of the C++ program would send expressions to the Racket thread evaluation via a pipe or some kind of semaphore-based communication. On Windows, you could also try using MzCOM, which is sort of half-way between managing your own thread and starting a separate process. -- Dan Liebgold[dan.liebg...@gmail.com] _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] embedding racket without overriding main?
Yes: Racket needs a consistent starting point for the GC'ed stack across calls into the Racket. At Mon, 24 Sep 2012 17:32:26 -0700, Dan Liebgold wrote: Is there any reason the scheme_main_setup trampoline can't be done later in the program (i.e. only at the point I want to invoke Racket stuff)? On Mon, Sep 24, 2012 at 5:09 PM, Matthew Flatt mfl...@cs.utah.edu wrote: At Mon, 24 Sep 2012 15:10:08 -0700, Dan Liebgold wrote: Does anyone have an example of embedding 3m Racket (5.3) in a C++ program without overriding main? I have a legacy C++ app that wants to eval some Racket code but I'd like to be minimally invasive. Might need to shell out... One strategy is to start a separate OS-level thread for Racket. The rest of the C++ program would send expressions to the Racket thread evaluation via a pipe or some kind of semaphore-based communication. On Windows, you could also try using MzCOM, which is sort of half-way between managing your own thread and starting a separate process. -- Dan Liebgold[dan.liebg...@gmail.com] _ Racket Developers list: http://lists.racket-lang.org/dev