Google Groups Home
Help | Sign in
Embedding Syx in C through Visual Studio
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 30 - Collapse all   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Nordlys  
View profile
 More options Jul 11, 6:42 am
From: Nordlys <itmarr...@gmail.com>
Date: Fri, 11 Jul 2008 03:42:26 -0700 (PDT)
Local: Fri, Jul 11 2008 6:42 am
Subject: Embedding Syx in C through Visual Studio
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 ;)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luca Bruno  
View profile
 More options Jul 11, 1:54 pm
From: Luca Bruno <lethalma...@gmail.com>
Date: Fri, 11 Jul 2008 12:54:11 -0500
Local: Fri, Jul 11 2008 1:54 pm
Subject: Re: [Syx] Embedding Syx in C through Visual Studio
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 11 Jul 2008 03:42:26 -0700 (PDT)

Nordlys <itmarr...@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-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nordlys  
View profile
 More options Jul 11, 10:01 am
From: Nordlys <itmarr...@gmail.com>
Date: Fri, 11 Jul 2008 07:01:01 -0700 (PDT)
Local: Fri, Jul 11 2008 10:01 am
Subject: Re: Embedding Syx in C through Visual Studio
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:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luca Bruno  
View profile
 More options Jul 11, 5:26 pm
From: Luca Bruno <lethalma...@gmail.com>
Date: Fri, 11 Jul 2008 16:26:00 -0500
Subject: Re: [Syx] Re: Embedding Syx in C through Visual Studio
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 11 Jul 2008 07:01:01 -0700 (PDT)

Nordlys <itmarr...@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-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nordlys  
View profile
 More options Jul 11, 11:56 am
From: Nordlys <itmarr...@gmail.com>
Date: Fri, 11 Jul 2008 08:56:30 -0700 (PDT)
Local: Fri, Jul 11 2008 11:56 am
Subject: Re: Embedding Syx in C through Visual Studio

> 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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luca Bruno  
View profile
 More options Jul 11, 7:10 pm
From: Luca Bruno <lethalma...@gmail.com>
Date: Fri, 11 Jul 2008 18:10:38 -0500
Local: Fri, Jul 11 2008 7:10 pm
Subject: Re: [Syx] Re: Embedding Syx in C through Visual Studio
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 11 Jul 2008 08:56:30 -0700 (PDT)

Nordlys <itmarr...@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-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nordlys  
View profile
 More options Jul 11, 5:20 pm
From: Nordlys <itmarr...@gmail.com>
Date: Fri, 11 Jul 2008 14:20:05 -0700 (PDT)
Local: Fri, Jul 11 2008 5:20 pm
Subject: Re: Embedding Syx in C through Visual Studio
> 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 :)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luca Bruno  
View profile
 More options Jul 12, 12:44 am
From: Luca Bruno <lethalma...@gmail.com>
Date: Fri, 11 Jul 2008 23:44:16 -0500
Local: Sat, Jul 12 2008 12:44 am
Subject: Re: [Syx] Re: Embedding Syx in C through Visual Studio
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 11 Jul 2008 14:20:05 -0700 (PDT)

Nordlys <itmarr...@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-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nordlys  
View profile
 More options Jul 14, 4:51 am
From: Nordlys <itmarr...@gmail.com>
Date: Mon, 14 Jul 2008 01:51:28 -0700 (PDT)
Local: Mon, Jul 14 2008 4:51 am
Subject: Re: Embedding Syx in C through Visual Studio
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.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nordlys  
View profile
 More options Jul 14, 5:10 am
From: Nordlys <itmarr...@gmail.com>
Date: Mon, 14 Jul 2008 02:10:14 -0700 (PDT)
Local: Mon, Jul 14 2008 5:10 am
Subject: Re: Embedding Syx in C through Visual Studio
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luca Bruno  
View profile
 More options Jul 14, 5:22 pm
From: Luca Bruno <lethalma...@gmail.com>
Date: Mon, 14 Jul 2008 16:22:37 -0500
Local: Mon, Jul 14 2008 5:22 pm
Subject: Re: [Syx] Re: Embedding Syx in C through Visual Studio