[racket-dev] unable to embed racket in a C++ program

From: Dan Liebgold (dan.liebgold at gmail.com)
Date: Mon Sep 24 12:58:45 EDT 2012

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 <mflatt at 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.liebgold at gmail.com]
> > _________________________
> >   Racket Developers list:
> >   http://lists.racket-lang.org/dev
>



-- 
Dan Liebgold    [dan.liebgold at gmail.com]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120924/5374d2e1/attachment.html>

Posted on the dev mailing list.