[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] Smalltalk and C++/libstdc++ problem
From: |
TheLordFerada |
Subject: |
[Help-smalltalk] Smalltalk and C++/libstdc++ problem |
Date: |
Tue, 27 Feb 2007 17:50:13 +0100 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hello,
I experimented a bit yesterday and wanted to use GNU Smalltalk together
with C++/g++, but the following two pieces of code [1] won't work when the
static string F.x is longer then zero characters.
First used versions (since I don't know which one causes the problem,
but suspecting libstdc++):
"Gentoo Linux 2.6.20 SMP x86_64 AMD Turion(tm)"
"gcc version 4.1.2 (Gentoo 4.1.2)"
"GNU Smalltalk version 2.3.3"
(When F.x is "" nothing happens, with "x" it causes a fast segmentation
fault and with more characters, it's an endless loop of "gst: gst: ...",
well, until final segmentation fault)
So can someone help me with that?
At the moment, I've got not other computer to test it on; so hopefully
it's something I did wrong ...
Thanks,
Olof Frahm
[1]
<---snip Test.cpp --->
extern "C" {
#include <gstpub.h>
#include <stdlib.h>
#include <stdio.h>
}
#include <iostream>
#include <string>
struct F
{
std::string x;
};
// "" -> nothing, "x" -> short sigsegv, "xy" ... -> long sigsegv
F f = { "12" };
extern "C" void func (void*);
void func (void* p)
{
printf ("func (%llx)\n", p);
}
int main (int argc, char* argv[])
{
int result;
gst_smalltalk_args (argc, (const char**) argv);
result = gst_init_smalltalk ();
printf ("smalltalk says %d\n", result);
gst_interpreter_proxy.defineCFunc ("func", (void*) &func);
gst_interpreter_proxy.evalCode ("FileStream fileIn: 'Test.st' !");
OOP x = gst_interpreter_proxy.perform (
gst_interpreter_proxy.classNameToOOP ("Abc"),
gst_interpreter_proxy.symbolToOOP ("new"));
OOP y = gst_interpreter_proxy.perform (x,
gst_interpreter_proxy.symbolToOOP ("world"));
return 0;
}
<--snip-->
<--snip Test.st -->
Object subclass: #Abc
instanceVariableNames: 'object'
classVariableNames: ''
poolDictionaries: ''
category: nil
!
!Abc methodsFor: 'all'!
new
^super new
!
object: aObject
object := aObject
!
world
'before' printNl.
self func: object.
'after' printNl.
!
func: aObject
<cCall: 'func' returning: #void args: #(#cObject)>
! !
<--snip-->
pgpVpHYJ8q9ko.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-smalltalk] Smalltalk and C++/libstdc++ problem,
TheLordFerada <=