chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] embedded scheme + static libraries on windows platfo


From: felix
Subject: Re: [Chicken-users] embedded scheme + static libraries on windows platform
Date: Tue, 03 Aug 2004 00:15:14 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Andrey Fomichev wrote:
Hello!

I'm using chicken as a scheme implementation, which can be easily integrated
into C/C++ program (embedded scheme). Concerning me, chicken is a very good
and helpful software. Thank you very much, Felix, for good work!

Thanks for using it!


But now I have a question. The version of chicken I've been using for a long
time was 0.1072... Yes, it's really old, but it works fine for me. But now I
decided to switch to the latest release (1.50) and noticed that there were
made
some changed to entry point interface and libraries (they have another
names now, for example). So, I got across with the following problem.

Suppose I have two files
- entry.scm with the entry point defined
- main.cpp with the function main and call to CHICKEN_invoke
To create the .exe  file I use the following commands (the platform is
Windows 2000, the C/C++ compiler is from .NET package):

chicken entry.scm
cl /c -DC_EMBEDDED entry.c
cl /c /EHsc -DC_EMBEDDED main.cpp
link main.obj entry.obj libchicken.lib libsrfi-chicken.lib
libstuffed-chicken.lib

This works fine and I get main.exe file. Unfortunately, this file requires
respected
dlls to be able to work. What I want is to make standalone .exe file. How
can I do it?

If I change libs to the analogous libs with the -static suffix during the
linking phase
(what is the most straightforward way from my point of view) I get an error.
Another words, executing the following command

link main.obj entry.obj libchicken-static.lib libsrfi-chicken-static.lib
libstuffed-chicken-static.lib

I get the following messages:

Microsoft (R) Incremental Linker Version 7.00.9466
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library main.lib and object main.exp
main.obj : error LNK2019: unresolved external symbol __imp__CHICKEN_invoke
referenced in function "int __cdecl process_query_in_

The problem is the missing /DC_NO_PIC_NO_DLL option that has to be used when
compiling entry.c (don't ask - to support all the different linking styles on
different platforms, some macro-hacks are being used).

To build your example the quick way:

csc -ev -static -o hello.exe main.cpp entry.scm -C /EHsc

Or the more elaborate:

chicken entry.scm
cl /DC_EMBEDDED /I%CHICKEN_HOME% /c /EHsc main.cpp /DC_NO_PIC_NO_DLL
cl /DC_EMBEDDED /I%CHICKEN_HOME% /c entry.c /DC_NO_PIC_NO_DLL
link /out:hello.exe main.obj entry.obj 
%CHICKEN_HOME%\libstuffed-chicken-static.lib \
  %CHICKEN_HOME%\libsrfi-chicken-static.lib %CHICKEN_HOME%\libchicken-static.lib


cheers,
felix




reply via email to

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