Embedding Syx in C through Visual Studio

8 views
Skip to first unread message

Nordlys

unread,
Jul 11, 2008, 6:42:26 AM7/11/08
to Syx general discussion
Hi Luca,

first of all I wanted to thank you for your work, which must have been
everything but easy, I can only guess how many hours (days / months /
years) you've spent on Syx.
I have recently started to get interested in Smalltalk and, since I
would like to use it as an embedded language, I got obviously
attracted to Syx :)

While i have been able to use it succesfully on linux, I have problems
in using it embedded under windows with Visual Studio Express 2008. I
read the discussion with Krzysztof Kowalczyk, but still I haven't
been able to succesfully start the VM.
I compiled succesfully the sln provided with the tar.gz, then
compiling my program with the generated lib file I get some errors:for
example, in syx-objects.h at line 413, SYX_VSPRINTF(string,
newstring), the compiler says that it can't convert from syx_pointer
to syx_string. Commenting the offending line allows me to compile, but
when I run it it crashes on syx_memory_load_image. Init, though, seems
to go fine.

Could you please give me some hint on how to succesfully embed in
Visual Studio? Should I use a library? Any help would be greatly
appreciated.

Thank you, and any other who might help :P

btw next time if you prefer I can switch to italian, though it might
get less "internationalized" :P For me both languages are totally
equivalent, pick your favourite ;)

Luca Bruno

unread,
Jul 11, 2008, 1:54:11 PM7/11/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 11 Jul 2008 03:42:26 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

>
> Hi Luca,
>

Hello.

> first of all I wanted to thank you for your work, which must have been
> everything but easy, I can only guess how many hours (days / months /
> years) you've spent on Syx.

Well yes, making it so portable and compatible with many systems
was hard, though there's so much work to do in the future.

> I have recently started to get interested in Smalltalk and, since I
> would like to use it as an embedded language, I got obviously
> attracted to Syx :)
>

Thanks very much :) I'm glad of this.

> While i have been able to use it succesfully on linux, I have problems
> in using it embedded under windows with Visual Studio Express 2008. I
> read the discussion with Krzysztof Kowalczyk, but still I haven't
> been able to succesfully start the VM.

I don't have Visual Studio, so I've no clue of it works.

> I compiled succesfully the sln provided with the tar.gz, then
> compiling my program with the generated lib file I get some errors:for
> example, in syx-objects.h at line 413, SYX_VSPRINTF(string,
> newstring), the compiler says that it can't convert from syx_pointer
> to syx_string. Commenting the offending line allows me to compile, but
> when I run it it crashes on syx_memory_load_image. Init, though, seems
> to go fine.
>

You shouldn't comment that line, it's very important.
There's no such syx_pointer there, I can't understand. It's
a problem of compatibility with compilers for sure.
At least, you can replace that line with:
new_string = strcpy (string);

And let me know if it works. I'm currently doing a bunch of work
refactoring the whole VM to adopt a new memory management.

> Could you please give me some hint on how to succesfully embed in
> Visual Studio? Should I use a library? Any help would be greatly
> appreciated.
>

Yes the library is libsyx. You can find online API documentation
and look at the embedding examples.
Some critical API is exposed, in the future I'll fix also that,
but you won't need it.

> btw next time if you prefer I can switch to italian, though it might
> get less "internationalized" :P For me both languages are totally
> equivalent, pick your favourite ;)

Oh no problem, we can continue with English so that everyone can reply :)
Thanks.

Best regards,

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkh3nkQACgkQw9Qj+8Kak3F3ugCfXydf6tVHQCmIO6UuFdLkp6mQ
36gAoIwRTMyKESqWNOM49ZKgDTWuQrWU
=SLuc
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 11, 2008, 10:01:01 AM7/11/08
to Syx general discussion
Thanks for answering this quickly! It is still not working. It doesn't
correctly do the init, I think it is a problem related to the library.
To get syx working on windows I compiled the syx distribution with the
given sln into a lib file I pass to the linker. This should be pretty
much equivalent to pass the -lsyx to the linker in gcc /
code::blocks / ...
So with lua I just tell the interpreter the lua50.lib library is
required. In linux I achieve the same result with a -llua50. So maybe
I compiled the library the wrong way? Did I miss a syx precompiled
library for windows?
strcpy (new_string, string); works. The compilation go without errors
but then crashes. Using the lib I compiled from the given sln the init
function is called and the program works when only init is called. If
then I try to use the load library... crash. Could it be that the
image does not load properly? I called the load image func with (NULL)
like in the example, maybe that doesn't work? I start getting a bit
confused... I don't know wher to put my hands. Somebody compiled it
correctly on Win with other tools? Is there a cmake solution working?
Cmake can generate sln files on windows. Do I have to link a lib at
all?

On 11 Lug, 19:54, Luca Bruno <lethalma...@gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Fri, 11 Jul 2008 03:42:26 -0700 (PDT)
>
> Yes the library islibsyx. You can find online API documentation
> and look at the embedding examples.
> Some critical API is exposed, in the future I'll fix also that,
> but you won't need it.
>
> > btw next time if you prefer I can switch to italian, though it might
> > get less "internationalized" :P For me both languages are totally
> > equivalent, pick your favourite ;)
>
> Oh no problem, we can continue with English so that everyone can reply :)
> Thanks.
>
> Best regards,
>
> - --http://syx.googlecode.com- Smalltalk YXhttp://lethalman.blogspot.com- Thoughts about computer technologieshttp://www.ammazzatecitutti.org- Ammazzateci tutti

Luca Bruno

unread,
Jul 11, 2008, 5:26:00 PM7/11/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 11 Jul 2008 07:01:01 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

>
> Thanks for answering this quickly! It is still not working. It doesn't
> correctly do the init, I think it is a problem related to the library.
> To get syx working on windows I compiled the syx distribution with the
> given sln into a lib file I pass to the linker. This should be pretty
> much equivalent to pass the -lsyx to the linker in gcc /
> code::blocks / ...
> So with lua I just tell the interpreter the lua50.lib library is
> required. In linux I achieve the same result with a -llua50. So maybe
> I compiled the library the wrong way? Did I miss a syx precompiled
> library for windows?

Yes. Both the installer and the win32 archive contains the library with include files
all ready for development:
http://code.google.com/p/syx/downloads/list

> strcpy (new_string, string); works. The compilation go without errors
> but then crashes. Using the lib I compiled from the given sln the init
> function is called and the program works when only init is called. If
> then I try to use the load library... crash. Could it be that the
> image does not load properly? I called the load image func with (NULL)
> like in the example, maybe that doesn't work?

It's strange it crashes when you load the image. It should return
a failure value instead.
Have you generated the image before loading it?
Are paths set correctly during the build?
SYX_ROOT_PATH and SYX_PLUGIN_PATH.

When you pass NULL to the load function it uses the default SYX_ROOT_PATH
to find the image on Linux. While on Windows if you pass NULL it looks
in the current directory.

Keep strcpy () please, or strings won't work properly.

> I start getting a bit
> confused... I don't know wher to put my hands.

I'm sorry of that.

> Somebody compiled it
> correctly on Win with other tools?
> Is there a cmake solution working?
> Cmake can generate sln files on windows. Do I have to link a lib at
> all?

No, there's a secondary build system with SCons which I currently use on Windows.

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkh3z+gACgkQw9Qj+8Kak3HKvACglIyYHUvKTyfPgpUixpMp+2vI
OIMAnRipRaPDoBSPXgxAdjUUT3TBebob
=MmVX
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 11, 2008, 11:56:30 AM7/11/08
to Syx general discussion
> Yes. Both the installer and the win32 archive contains the library with include files
> all ready for development:http://code.google.com/p/syx/downloads/list

copied all files in the zip in the main folder, libs and include in
Visual Studio's folders.

> It's strange it crashes when you load the image. It should return
> a failure value instead.
> Have you generated the image before loading it?
> Are paths set correctly during the build?
> SYX_ROOT_PATH and SYX_PLUGIN_PATH.

I am using default image. copied in all the folders just to be sure.
also tried the working one from linux.
I don't think I should need to pass the dll to the linker somewhere,
the .a library file, once passed to the linker, seems to crash even
earlier.
Maybe it's my mistake somewhere there, the way I include the
libraries.

> When you pass NULL to the load function it uses the default SYX_ROOT_PATH
> to find the image on Linux. While on Windows if you pass NULL it looks
> in the current directory.

it should find the image then

> Keep strcpy () please, or strings won't work properly.

I will keep the strcpy you suggested me as it raise no error :P

> > I start getting a bit
> > confused... I don't know wher to put my hands.
>
> I'm sorry of that.

Not your fault :P

>
> No, there's a secondary build system with SCons which I currently use on Windows.

The people I am working with sticks with Visual Studio, so I am trying
to make it work there.
I think it could fit better than lua in our development, I hope I can
fix this thing shortly, I will make more tests.
I need to move to other tasks soon, but I will keep trying for a
while ;)

I'll keep an eye on this page to see if anyone has suggestions :)
Thanks for your help, I'll let you know if it works.

D.

Luca Bruno

unread,
Jul 11, 2008, 7:10:38 PM7/11/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 11 Jul 2008 08:56:30 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

> I am using default image. copied in all the folders just to be sure.
> also tried the working one from linux.
> I don't think I should need to pass the dll to the linker somewhere,
> the .a library file, once passed to the linker, seems to crash even
> earlier.
> Maybe it's my mistake somewhere there, the way I include the
> libraries.
>

Why are you recompiling syx then? But yes, you have to pass the dll,
how would you else link against syx? I've never used the .a library though.
Maybe I've no right clue of what you're doing :)

Are you trying to compile Syx?
Can you give me the full command line used for compilation? Only one line for
one file to let me see how Visual Studio is handling the project.

>
> The people I am working with sticks with Visual Studio, so I am trying
> to make it work there.
> I think it could fit better than lua in our development, I hope I can
> fix this thing shortly, I will make more tests.
> I need to move to other tasks soon, but I will keep trying for a
> while ;)
>

Syx is not as stable, usable and complete as lua for production,
so I'd not suggest to use it. API breaks will happen often.

> I'll keep an eye on this page to see if anyone has suggestions :)
> Thanks for your help, I'll let you know if it works.
>

Thanks for your interest.

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkh36G4ACgkQw9Qj+8Kak3GnewCfTeTWWvJyYUq2NKuPdLsNn1br
beYAnRwLTVoU9GymFlcbP13deWjeWA18
=+19D
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 11, 2008, 5:20:05 PM7/11/08
to Syx general discussion
> Why are you recompilingsyxthen? But yes, you have to pass the dll,
> how would you else link againstsyx? I've never used the .a library though.
> Maybe I've no right clue of what you're doing :)
>
I guess dll are linked at runtime being dynamic libraries, so there
should be no need to pass to the linker. I am not that much
experienced about compiling libraries. Usually there is either a lib
to use within the compiling or the code to link the dll that you write
in the code (not give to the linker then)
The only one thing I want to do is to embed syx so that i can pass
scripts to the interpreter and get the result.

> Are you trying to compileSyx?
> Can you give me the full command line used for compilation? Only one line for
> one file to let me see how Visual Studio is handling the project.

I just opened the sln file give and compiled. I will check this thing
as soon ans possible and post it here.

> Syxis not as stable, usable and complete as lua for production,
> so I'd not suggest to use it. API breaks will happen often.

So then maybe you can give me a suggestion here. As far as now my lua
scripts calls registered c function, they can be live coded while the
executable is running but they are not called at any cycle of the main
application loop. Also my c code might pass the interpreter/VM things
it needs to interpretate when needed. I am using the scripting
language to code functionality, but I am oriented on calling scripts
only once in a while. Lua changed api from 5.0 to 5.1 some heavily. I
am mostly intersted that my scripts can run without being rewritten.
Script will mostly work with interface definition (positions and such)
and the smalltalk syntax, with named parameters, sounded clear enough
to be used by anyone. Since I do not need that much libraries, and
just registering easily functions and run simple code should be
enough, I thought Syx could be worth a try. Do you think it might
serve my purpose?

greetings :)

Luca Bruno

unread,
Jul 12, 2008, 12:44:16 AM7/12/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 11 Jul 2008 14:20:05 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

> I guess dll are linked at runtime being dynamic libraries, so there
> should be no need to pass to the linker.

Oh you're loading it dynamically ok, I haven't understood yet.

> I am not that much
> experienced about compiling libraries. Usually there is either a lib
> to use within the compiling or the code to link the dll that you write
> in the code (not give to the linker then)
> The only one thing I want to do is to embed syx so that i can pass
> scripts to the interpreter and get the result.

So you need the whole zip, you don't need to recompile Syx.
Steps:
1) Load the dll
2) syx_init (argc, argv, NULL);
3) syx_memory_load_image (NULL);
4) ...
5) syx_quit ()

I'm sorry I haven't understood yet. Can you tell me on which step do you get the crash?

> So then maybe you can give me a suggestion here. As far as now my lua
> scripts calls registered c function, they can be live coded while the
> executable is running but they are not called at any cycle of the main
> application loop.

Can you explain better? You can call C functions from Smalltalk.
No need to register those functions. You can look at the embed examples.

> Also my c code might pass the interpreter/VM things
> it needs to interpretate when needed.

Again I've not understood what you mean here.

> Script will mostly work with interface definition (positions and such)

Can you explain better?

> and the smalltalk syntax, with named parameters, sounded clear enough
> to be used by anyone. Since I do not need that much libraries, and
> just registering easily functions and run simple code should be
> enough, I thought Syx could be worth a try. Do you think it might
> serve my purpose?
>
> greetings :)

Well, after the next release I think primitives will be freezed for a long while.
And they can change only slightly from version to version.
It doesn't affect the scripts, but only the C code. I think the C code won't be a problem for you.
For example, the API has been freezed for 2-3 release before the current 0.1.7.
Then I only changed some parameters when creating processes and contexts.
Now I only change how to access variables and arrays.
I think it's not such big refactoring.
If you have only to run simple code, when (I really hope :) ) you get it running, you can
delete 80% of the stuff in the syx zip. All the additional DLLs are part of the GTK+ plugin.

Currently performances are not better than other implementation, and of course Lua is faster.
But with the new VM we're developing the next release speed will be heavily improved.

Best regards,

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkh4NqAACgkQw9Qj+8Kak3H3jgCfU12YZavQpfdDkistC0VyG2Mn
EKwAn2QSIC/vEkHzOiPQtfWuo/68lyly
=zNdB
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 14, 2008, 4:51:28 AM7/14/08
to Syx general discussion
Dear Luca,
we are still trying to embed six but we still have some problems.

Lets start from the beginning:

In the source and in the binaries the only libraries we found are
libsyx.a and syx.dll.
The first one is the static library we use on linux and it works well.
In windows it has not the same result and it makes the application
crash every time we call a syx command (the syx_init too).
The dll cannot be associated to a project… it must be linked by the
code so there is no need to set it somewhere, as far as i know.
So which library should then be used? Usually in Visual Studio we use
lib files for static libraries so we thought to get the lib by
compiling the source with sln solution you have in the zip file (some
libraries need this step to be done). From that we get a lib file and
with this lib we are able to do the init, but it crashes in the load
image function.

We want to do the following things with syx:

We launch our C++ program. In the beginning we init syx, any way is
fine, both linking a dll (but I don't know how to do it, this is the
point :P) or lib. We pass the script some files, it executes the
scripts setting up C++ objects (in lua we call registered C++
functions that sets values with the passed parameters). We have a
shell box we type text in. We pass it to the interpreter to
interpretate and execute it (luaL_doString() like). So we want to pass
code to syx for it to be executed and call C from syx (the usual
answer to code sent to syx). C code needs to run damn fast, so all the
objects are in C to minimize access costs.

I hope this makes it easier for you to understand. Looking forward for
you wise reply ;)

thanks

D.

Nordlys

unread,
Jul 14, 2008, 5:10:14 AM7/14/08
to Syx general discussion
P.S.
I am using Visual Studio 2008 express (the free [as in beer] edition)
This is my visual studio "command line" as it reutrns it:

Compiler:

/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_VC80_UPGRADE=0x0710" /D
"_MBCS" /Gm /EHsc /RTC1 /MTd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W2 /
nologo /c /Wp64 /ZI /TP /errorReport:prompt

Linker:
/OUT:"Debug/TDLEngine.exe" /INCREMENTAL /NOLOGO /MANIFEST /
MANIFESTFILE:"Debug\TDLEngine.exe.intermediate.manifest" /
MANIFESTUAC:"level='asInvoker' uiAccess='false'" /NODEFAULTLIB /DEBUG /
PDB:"Debug/TDLEngine.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE:NO /
MACHINE:X86 /ERRORREPORT:PROMPT lua50.lib lib3ds-1_3d.lib sdl.lib
sdl_image.lib MSVCRTD.lib msvcprtd.lib msvcrt.lib sdlmain.lib
opengl32.lib glu32.lib glut32.lib kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Luca Bruno

unread,
Jul 14, 2008, 5:22:37 PM7/14/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Dear Luca,
> we are still trying to embed six but we still have some problems.
>

I'm really sorry.

> Lets start from the beginning:
>
> In the source and in the binaries the only libraries we found are
> libsyx.a and syx.dll.
> The first one is the static library we use on linux and it works well.
> In windows it has not the same result and it makes the application
> crash every time we call a syx command (the syx_init too).
> The dll cannot be associated to a project… it must be linked by the
> code so there is no need to set it somewhere, as far as i know.
> So which library should then be used? Usually in Visual Studio we use
> lib files for static libraries so we thought to get the lib by
> compiling the source with sln solution you have in the zip file (some
> libraries need this step to be done). From that we get a lib file and
> with this lib we are able to do the init, but it crashes in the load
> image function.
>

I fear there're some problems with mingw for the precompiled syx.dll.
- From what I see in the other mail MSVC is missing some macros very important for the initialization when compiling.
I'd try this:
syx_init (argc, argv, ABSOLUTE PATH OF SYX ROOT)
or
syx_init (0, NULL, ABSOLUTE PATH OF SYX ROOT)

The important thing is that path must contain default.sim.
If this work you are at a good point, well you've done and we can talk more :)

> We want to do the following things with syx:
>
> We launch our C++ program. In the beginning we init syx, any way is
> fine, both linking a dll (but I don't know how to do it, this is the
> point :P) or lib. We pass the script some files, it executes the
> scripts setting up C++ objects (in lua we call registered C++
> functions that sets values with the passed parameters).

So create a class, the files will work on the instances of that class,
once done you get the instance variables of that class and create the C++ objects.

> We have a
> shell box we type text in. We pass it to the interpreter to
> interpretate and execute it (luaL_doString() like). So we want to pass
> code to syx for it to be executed and call C from syx (the usual
> answer to code sent to syx). C code needs to run damn fast, so all the
> objects are in C to minimize access costs.
>

These are called primitives. There're several way to do that, I suggest you to look in the examples/embed directory.

>
> thanks
>

Thanks to you

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkh7w50ACgkQw9Qj+8Kak3HeDACfei+V/Af8wCaA6K+bni2c1xSV
hVEAmgJ7jDX3QlzTyiDiPI4Owf03cv/w
=r25/
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 14, 2008, 11:33:34 AM7/14/08
to Syx general discussion
This:
> syx_init (argc, argv, ABSOLUTE PATH OF SYX ROOT)
> or
> syx_init (0, NULL, ABSOLUTE PATH OF SYX ROOT)
didn't work, so the .a file might have some problems.

I do not know how the dll is called, should it be me to call it
explicitly? I guess it is called by some of the syx files... do you
have any gcc/window command line with the compilation string?

I'm about to go further into the topic, but as far as now I see no way
through :S
I'll try more later.

Thanks, D.

Luca Bruno

unread,
Jul 14, 2008, 6:40:36 PM7/14/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 14 Jul 2008 08:33:34 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

>
> This:
> > syx_init (argc, argv, ABSOLUTE PATH OF SYX ROOT)
> > or
> > syx_init (0, NULL, ABSOLUTE PATH OF SYX ROOT)
> didn't work, so the .a file might have some problems.
>

Forgot to say, try with the library created by your own.

> I do not know how the dll is called, should it be me to call it
> explicitly? I guess it is called by some of the syx files... do you
> have any gcc/window command line with the compilation string?
>

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -ansi -pedantic -Wall
- -Wno-strict-aliasing -DROOT_PATH=/usr/local/share/syx
- -DIMAGE_PATH=/usr/local/share/syx/default.sim
- -DPLUGIN_PATH=/usr/local/lib/syx -g -O2 -MT libsyx_la-syx-bytecode.lo
- -MD -MP -MF .deps/libsyx_la-syx-bytecode.Tpo -c syx-bytecode.c -fPIC
- -DPIC -o .libs/libsyx_la-syx-bytecode.o

> I'm about to go further into the topic, but as far as now I see no way
> through :S
> I'll try more later.
>
> Thanks, D.

Do you know any good free Visual Studio? I've searched here and I think I've lost my Visual Studio 6 :)

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkh71eQACgkQw9Qj+8Kak3EjTACdH3YSRFZ/Gf1EREiTEtX23/tk
qEgAn21rbwkxkJKDqZK8RwKREBhK845P
=SzDZ
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 14, 2008, 1:22:58 PM7/14/08
to Syx general discussion
At the webpage http://www.microsoft.com/express/download/ it is
possible to download the express edition of Visual Studio. It is free
of charge, though after a bunch of days it requires the activation,
which is free for people owning a valid windows operative system.

Thank you thousand for your support, Luca! I really hope everything
goes well.

D.

Lethalman

unread,
Jul 15, 2008, 6:21:01 AM7/15/08
to Syx general discussion
It crashes with both solutions.

I managed to create a new project from scratch and compile syx.
I've created a test project and I can link syx and call functions
without any crash.
The image loads, but I can't do any operations because there're
problem on some external declarations (e.g.):
test.obj : error LNK2020: unresolved token (0A000031) syx_string_class
test.obj : error LNK2020: unresolved token (0A00003C) syx_nil
test.obj : error LNK2001: unresolved external symbol _syx_string_class
test.obj : error LNK2001: unresolved external symbol _syx_nil

These are defined in syx-object.h as:
EXPORT SyxOop syx_nil,
syx_true,
syx_false,
...

Where:
# ifdef _DLL
# define EXPORT __declspec(dllexport) extern
# else
# define EXPORT __declspec(dllimport) extern
# endif /* _DLL */

And in syx-object.c
SyxOop syx_nil,
syx_true,
syx_false,
...

And I'm pretty sure EXPORT will do dllexport because _DLL is defined
when compiling syx, and dllimport when compiling the test. Any hints?

On 14 Lug, 19:22, Nordlys <itmarr...@gmail.com> wrote:
> At the webpagehttp://www.microsoft.com/express/download/it is

Nordlys

unread,
Jul 15, 2008, 6:35:44 AM7/15/08
to Syx general discussion
could you send me the project files, so I can see if I can do
something? You gone further than I did :P
I will try to solve the issue, i'll unleash the power of all the c++
programmers here ;)

if you can send me a zip/rar/tgz via email that would be fine. I hope
we will find a solution in the end, we're getting everytime a step
closer :P

D.

Lethalman

unread,
Jul 15, 2008, 5:42:37 PM7/15/08
to Syx general discussion
http://groups.google.com/group/syx-discuss/web/syx.zip

I've created it starting from CLR class library, is that good for you?

Nordlys

unread,
Jul 15, 2008, 6:48:15 PM7/15/08
to Syx general discussion
I'll try it out tomorrow [-> later today, since midnight's passed], I
usually don't use CLR but I might be able to turn it some way
eventually :P

Thank you thousand!
D.

Nordlys

unread,
Jul 17, 2008, 10:15:31 AM7/17/08
to Syx general discussion
For some compatibility reasons with new sofware to be written with
cuda, we decided to try move the project to gcc/mingw. Not an easy
choice, which is bringing out some problems. On the other hands things
should have gone better for syx... theoretically.
On windows syx loads successfully. Still when I try loading do-me.st
the executable crash. SYX_VSPRINTF doesn't work. Changed to
strcpy(new_string, string). Same on Linux, where also compilation
fails for 4 errors:
/usr/local/include/syx/syx-object.h|294|error: "/" may not appear in
macro parameter list|
/usr/local/include/syx/syx-object.h|135|error: expected unqualified-id
before ‘/’ token|
/usr/local/include/syx/syx-object.h|449|error: ‘syx_globals’ was not
declared in this scope|
/usr/local/include/syx/syx-object.h|475|error:
‘syx_block_closure_class’ was not declared in this scope|

It works anyway when I build the example alone in the example folder.
I used the flags you posted earlier

-lGL -lGLU -l3ds -llua5.1 -ldl -lSDL -lSDL_image -lsyx -std=gnu99 -
DHAVE_CONFIG_H -I. -I.. -ansi -pedantic -Wall -Wno-strict-aliasing -
DROOT_PATH=/usr/local/share/syx -DIMAGE_PATH=/usr/local/share/syx/
default.sim -DPLUGIN_PATH=/usr/local/lib/syx -g -O2 -MT libsyx_la-syx-
bytecode.lo -MD -MP -MF .deps/libsyx_la-syx-bytecode.Tpo -c syx-
bytecode.c -fPIC -DPIC -o .libs/libsyx_la-syx-bytecode.o

Still it doesn't work. Am I doing something wrong?

Luca Bruno

unread,
Jul 17, 2008, 11:34:35 PM7/17/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm really sorry. I'll work to fix these issues these days.
I've been erroneous when testing it because I've used examples instead of creating a test project and embed Syx.
The problem with exported symbols has been always an issue somehow I'm going to fix forever for all environments.

Thanks very much.

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiAD0sACgkQw9Qj+8Kak3Gb1wCeKLFlabSeWk9SF1TRkuWmIDoL
V54An3gun4pZTaIpPnrvKIFfhhldpXmi
=HP8R
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 17, 2008, 5:22:52 PM7/17/08
to Syx general discussion
Thank you for answering all the time and caring about :)

My plan now is to follow these steps:

1. get syx working into my engine
2. convert one of my test lua scenario to syx
3. make some comparisons and get some final thoughts

I might need a little bit of help for the point 2, but if you can help
me get out of it I'd be glad to write down some instructions that you
can then insert in the documentation :)
Keep me updated :D

Thanks and good work ;)

D.

Nordlys

unread,
Jul 18, 2008, 6:38:24 AM7/18/08
to Syx general discussion
I am trying to do this:

C++ LUA

text inserted in InputBox
enter key pressed
luaL_doString(givenString) =>
receive string
interpretate string
oh, it's a shader!
call c function and pass
the specified parameter
eg mapping string
to number
<=
shader set
scene updated

This is how the C++ function is defined:

int setShader(lua_State *L)
{
int type=lua_tonumber(L,1);
shaders.current=type;
return 1;
}

The lua string is just setShader(1) which is the inserted string on
the input box.
So I have several calls of one function with different parameters.
Is there any documentation in syx to describe the whole thing both
ways?
The example calls a Syx function, but I need something more similar to
an eval() function
(fundamentally the execution of a block passed as a string).
Then I seem to understand I need a primitive. Any place I can found
docs?
This far I am reading Smalltalk by Example and Squeak by Example to
learn some smalltalk, if you have other suggestions as sources they'd
be welcome :)

I hope I am not bothering, just try to see how syx could fit in my
app. I know you already have plenty of work to do, so in case you find
it bothering just say it, no offense :P

Greetings and wishes of a good day :)
D.

Luca Bruno

unread,
Jul 18, 2008, 12:39:41 PM7/18/08
to syx-d...@googlegroups.com
In data 18 luglio 2008 alle ore 12:38:24, Nordlys <itma...@gmail.com> ha
scritto:

> I am trying to do this:
>
> C++ LUA
>
> text inserted in InputBox
> enter key pressed
> luaL_doString(givenString) =>
> receive string
> interpretate string
> oh, it's a shader!
> call c function and pass
> the specified parameter
> eg mapping string
> to number
> <=
> shader set
> scene updated
>
> This is how the C++ function is defined:
>
> int setShader(lua_State *L)
> {
> int type=lua_tonumber(L,1);
> shaders.current=type;
> return 1;
> }
>

If I've understood this would traduce to:

[Smalltalk]
Smalltalk cCall: 'setShader' withArguments: #(1)

[C side]
SYX_FUNC_PRIMITIVE(setShader)
{
SYX_PRIM_ARGS(1); /* ensure there's at least one parameter, it's optional
*/
int type = SYX_SMALL_INTEGER (es->message_arguments[0]);
shaders.current = type;
return 1;
}

[Interpreting the smalltalk code]
SyxOop process = syx_process_new ();
SyxOop string = syx_string_new (CODE_TO_BE_INTERPRETED);
SyxOop context = syx_send_unary_message (string, "doIt");
syx_interp_enter_context (process, context);
syx_process_execute_blocking (process);

As you can see, it's much more verbose.
For the next release I intend to create some helper functions for
interpreting text,
so that you can do something like:
SyxOop process = syx_string_execute_blocking (receiver,
CODE_TO_BE_INTERPRETED);

While for the Smalltalk code, well it's smalltalk :) There're no
functions, only methods.
But you can still do something more clean (IMHO), run the interpreted code
into an object.
You can create such a class:

Object subclass: #Application
instanceVariableNames: ''!

!Application methodsFor: 'primitives'
shader: aValue
<cCall: 'setShader'>
! !

Then you can have a string to interpret like this:
self shader: 1

That's it, yet more verbose. If you like you can also add instance
variables and so on to the object and access them after the interpretation.

No you're not bothering me. Though syx is really young and not as stable
as other languages, I care about quality, so I'm not happy with these
problems.

I'd suggest you to read the GNU smalltalk documentation.

> The lua string is just setShader(1) which is the inserted string on
> the input box.
> So I have several calls of one function with different parameters.
> Is there any documentation in syx to describe the whole thing both
> ways?
> The example calls a Syx function, but I need something more similar to
> an eval() function
> (fundamentally the execution of a block passed as a string).
> Then I seem to understand I need a primitive. Any place I can found
> docs?
> This far I am reading Smalltalk by Example and Squeak by Example to
> learn some smalltalk, if you have other suggestions as sources they'd
> be welcome :)
>
> I hope I am not bothering, just try to see how syx could fit in my
> app. I know you already have plenty of work to do, so in case you find
> it bothering just say it, no offense :P
>
> Greetings and wishes of a good day :)
> D.

--

http://lethalman.blogspot.com - Thoughts about computer technologies

http://code.google.com/p/syx - A new Smalltalk implementation
http://www.ammazzatecitutti.org - E adesso ammazzateci tutti

Nordlys

unread,
Jul 20, 2008, 6:16:16 AM7/20/08
to Syx general discussion
> If I've understood this would traduce to:
>
> [Smalltalk]
> Smalltalk cCall: 'setShader' withArguments: #(1)
...
> syx_interp_enter_context (process, context);
> syx_process_execute_blocking (process);

Can't wait to try it :)

> As you can see, it's much more verbose.
> For the next release I intend to create some helper functions for  
> interpreting text,
> so that you can do something like:
> SyxOop process = syx_string_execute_blocking (receiver,  
> CODE_TO_BE_INTERPRETED);

This could be nice, helper functions are always welcome :P

> While for the Smalltalk code, well it's smalltalk :) There're no  
> functions, only methods.
> But you can still do something more clean (IMHO), run the interpreted code  
> into an object.
> You can create such a class:
>
> Object subclass: #Application
>         instanceVariableNames: ''!
>
> !Application methodsFor: 'primitives'
> shader: aValue
>      <cCall: 'setShader'>
> ! !
>
> Then you can have a string to interpret like this:
> self shader: 1
>
> That's it, yet more verbose. If you like you can also add instance  
> variables and so on to the object and access them after the interpretation.

Worth a try :)

> No you're not bothering me. Though syx is really young and not as stable  
> as other languages, I care about quality, so I'm not happy with these  
> problems.

Glad to know I'm not bothering. Code without problems is often
useless code. Errors shows you try to do well, and theyìre not that
bad as long as you fix them.
Glad to know you care much about quality, I've noticed you're putting
much efforts: i've seen your comments, on ohloh, also on other
smalltalk implementation, Syx has a citation with respect on Cincom's
paper for the 2008 smalltalk's talk papers, I've noticed. So keep gong
on, sounds like you're doing good.

> I'd suggest you to read the GNU smalltalk documentation.

I've read something more than a half of it.

I really think Syx is an interesting project. I guess its
documentation is still very much in development, and it is young, but
it is also promising. I am now seeing it in the light of my purpose, a
kind of runtime extension for my app, and I think it will be really
nice, while finished, to have an easy embeddable / easy interfaceable
language to give some runtime capability to C high-speed engines. I
will be glad to give you as much feedback as possible.

Some last questions... Do you have any idea how many days it'll take
to fix Syx so that I can run it on linux or windows using gcc/
code::blocks? DO you already have a roadmap for the next version?

Good day and good work on Syx ;)

D.

Luca Bruno

unread,
Jul 20, 2008, 1:39:31 PM7/20/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 20 Jul 2008 03:16:16 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

> I really think Syx is an interesting project. I guess its
> documentation is still very much in development, and it is young, but
> it is also promising. I am now seeing it in the light of my purpose, a
> kind of runtime extension for my app, and I think it will be really
> nice, while finished, to have an easy embeddable / easy interfaceable
> language to give some runtime capability to C high-speed engines. I
> will be glad to give you as much feedback as possible.
>

Thanks, it's important for me to know about community interest on Syx :)

> Some last questions... Do you have any idea how many days it'll take
> to fix Syx so that I can run it on linux or windows using gcc/
> code::blocks? DO you already have a roadmap for the next version?
>
> Good day and good work on Syx ;)
>
> D.

It works on Linux.
On windows, it would take a few days of testing and fixing headers.
I'm currently working on the "object" branch, you can see a bunch of commits
to make the new memory management work. I'm going to post some benchmarks against the other system.
Once done that I'll work on the master branch to fix Windows embedding.

Bye.

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiDeFMACgkQw9Qj+8Kak3EC8wCgkh7ISUiWuAiMBU/M7lyFN9QE
bGAAniEYL30ZwfFoWU/NX485PxwAhkqZ
=zYi/
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 20, 2008, 10:23:25 AM7/20/08
to Syx general discussion
> It works on Linux.
> On windows, it would take a few days of testing and fixing headers.

I get the compilation errors with syx I reported earlier on Linux
(Mint 4 Daryna, based on Ubuntu 7.10 Gutsy Gibbon) using gcc. Th
embedding example works with the scons solution but when I insert
#include <syx/syx.h> it reports the path errors I described, even if
just the include line (and nothing else) is in my code. I am using
code::blocks as ide, if this can matter anyhow.
On windows I tried and it crashes when it loads the file, but raise no
header matter. I tried recompiling into a .a library, but compiling
on msys raises errors. This confused me, the fact none of the two
operative systems seems to have it working with gcc / mingw+msys.
So I can't embed correctly on linux either, maybe I made something
wrong, but I think I did everything correct.

D.

On 20 Lug, 19:39, Luca Bruno <lethalma...@gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sun, 20 Jul 2008 03:16:16 -0700 (PDT)
>
> Nordlys <itmarr...@gmail.com> wrote:
> > I really think Syx is an interesting project. I guess its
> > documentation is still very much in development, and it is young, but
> > it is also promising. I am now seeing it in the light of my purpose, a
> > kind of runtime extension for my app, and I think it will be really
> > nice, while finished, to have an easy embeddable / easy interfaceable
> > language to give some runtime capability to C high-speed engines. I
> > will be glad to give you as much feedback as possible.
>
> Thanks, it's important for me to know about community interest on Syx :)
>
> > Some last questions... Do you have any idea how many days it'll take
> > to fix Syx so that I can run it on linux or windows using gcc/
> > code::blocks? DO you already have a roadmap for the next version?
>
> > Good day and good work on Syx ;)
>
> > D.
>
> It works on Linux.
> On windows, it would take a few days of testing and fixing headers.
> I'm currently working on the "object" branch, you can see a bunch of commits
> to make the new memory management work. I'm going to post some benchmarks against the other system.
> Once done that I'll work on the master branch to fix Windows embedding.
>
> Bye.
>
> - --http://syx.googlecode.com- Smalltalk YXhttp://lethalman.blogspot.com- Thoughts about computer technologieshttp://www.ammazzatecitutti.org- Ammazzateci tutti

Luca Bruno

unread,
Jul 20, 2008, 10:29:04 PM7/20/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 20 Jul 2008 07:23:25 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

> I get the compilation errors with syx I reported earlier on Linux
> (Mint 4 Daryna, based on Ubuntu 7.10 Gutsy Gibbon) using gcc.

Uh didn't catch that. Can you attach the whole log? Could you use GNU autotools instead of scons on GNU/Linux?
It's very weird, because of course I compile it good and I embed it without any problems.

Th
> embedding example works with the scons solution but when I insert
> #include <syx/syx.h> it reports the path errors I described, even if
> just the include line (and nothing else) is in my code. I am using
> code::blocks as ide, if this can matter anyhow.
> On windows I tried and it crashes when it loads the file, but raise no
> header matter. I tried recompiling into a .a library, but compiling
> on msys raises errors. This confused me, the fact none of the two
> operative systems seems to have it working with gcc / mingw+msys.
> So I can't embed correctly on linux either, maybe I made something
> wrong, but I think I did everything correct.
>

It can make sense, as I said I'll work on it and let you know.

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiD9HEACgkQw9Qj+8Kak3FuhgCcCMHRrR/i9x1YrEkvNEYRTilN
vjgAnRCLpfSZA9Sx+sdmWQEZ4xu+WXAv
=QEzo
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 20, 2008, 3:52:28 PM7/20/08
to Syx general discussion
Compiling: Draw.cpp
In file included from /usr/local/include/syx/syx.h:28,
from /home/nordlys/eTDL/Draw.cpp:5:
/usr/local/include/syx/syx-object.h:294:35: error: "/" may not appear
in macro parameter list
/usr/local/include/syx/syx-object.h:135: error: expected unqualified-
id before ‘/’ token
/usr/local/include/syx/syx-object.h: In function ‘SyxOop
syx_semaphore_new()’:
/usr/local/include/syx/syx-object.h:449: error: ‘syx_globals’ was not
declared in this scope
/usr/local/include/syx/syx-object.h: In function ‘SyxOop
syx_block_closure_new(SyxOop)’:
/usr/local/include/syx/syx-object.h:475: error:
‘syx_block_closure_class’ was not declared in this scope
Process terminated with status 1 (0 minutes, 1 seconds)
4 errors, 0 warnings

Commenting the include of Syx:

Process terminated with status 0 (0 minutes, 7 seconds)
0 errors, 0 warnings

I am using gcc in code::Blocks ide, it generates the makefile given
the parameters to pass to gcc, in my case -lGL -lGLU -l3ds -llua5.1 -
ldl -lSDL -lSDL_image -lsyx, but I also tried passing all the
paremeters you posted about, it still didn't work. It complaines about
the use of / symbol mostly. The makefile you used in the example
embedding folder works. But when I put the include in my project the
inclusion doesn't work, is there anything it is set without me to know
that can make it complain about that / ?

The first error reported is on this line

#define SYX_CONTEXT_PART_STACK(oop/usr/local/include/syx)
(SYX_OBJECT_VARS(oop)[SYX_VARS_CONTEXT_PART_STACK])
>>> /usr/local/include/syx/syx-object.h|294|error: "/" may not appear in macro parameter list

followed by

syx_dictionary_class,/usr/local/include/syx
>>> /usr/local/include/syx/syx-object.h|135|error: expected unqualified-id before ‘/’ token

both complaining for the /

Then scoping, maybe due to the previous errors:

/usr/local/include/syx/syx-object.h||In function ‘SyxOop
syx_semaphore_new()’:
/usr/local/include/syx/syx-object.h|449|error: ‘syx_globals’ was not
declared in this scope

and

/usr/local/include/syx/syx-object.h||In function ‘SyxOop
syx_block_closure_new(SyxOop)’:
/usr/local/include/syx/syx-object.h|475|error:
‘syx_block_closure_class’ was not declared in this scope

Maybe differences between libraries or something due to the ide? This
why I was asking if I did something wrong, as syx actually works. when
I launch syx it works, and the example works too. But then I get these
errors i reported. Suggestions?

Thank you :)

D.

Luca Bruno

unread,
Jul 20, 2008, 10:56:59 PM7/20/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It's definitively a problem of the build system of code::blocks and such.
If you look at syx-object.h on that like there's no such code.
It's oop not oop/usr/local/include/syx

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiD+vsACgkQw9Qj+8Kak3GkwwCfZi/34iKqSkfHvNWlDx/xIE8b
Wg8AnRhMkj29zX3hS0HGAHlO0y8TXwI/
=3hme
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 20, 2008, 4:13:45 PM7/20/08
to Syx general discussion
Luca,
this time is completely my fault on this linux thing, and I beg
forgiveness. I should have notice myself that those parts were not
making sense at all. I have an horrible touchpad on my new laptop, and
it doesn't work super well. Sometimes when I click the left button the
middle one clicks too and paste the last thing I have been
selecting... usually a path from nautilus/terminal.
So I messed up the code accidentally, my mistake. Tomorrow I'll try
the code you suggested there on our linux version. On linux now I have
things working.

I'll stay tuned for news on windows and the new version of syx along
with it :) And I will try to give you as much feedback as possible

Thanks, good work :D

D.
Reply all
Reply to author
Forward
0 new messages