DLD not working?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

DLD not working?

Rob Hoelz
Hello Smalltalkers of the GNU variety,

I'm trying to get the DLD class to work so I can call Xlib functions,
but I figured I'd try it out on libc functions first so I can figure
out how to use it.  However, I can't seem to get it to work even for
libc.  Here's the code I'm trying to use:

DLD addLibrary: 'libc'.

!SystemDictionary methodsFor: 'c callouts'!
stringCompare: lhs with: rhs
    <cCall: 'strcmp' returning: #int args: #(#string #string)>
! !

Transcript print: (Smalltalk stringCompare: 'foo' with: 'bar'); cr.

I've tried various arguments to DLD addLibrary (like '/usr/lib/libc',
stuff like that), but to no avail.  Could someone please let me know
what I'm doing wrong?

Thanks,
Rob Hoelz


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: DLD not working?

Paolo Bonzini
> DLD addLibrary: 'libc'.
>
> !SystemDictionary methodsFor: 'c callouts'!
> stringCompare: lhs with: rhs
>     <cCall: 'strcmp' returning: #int args: #(#string #string)>
> ! !
>
> Transcript print: (Smalltalk stringCompare: 'foo' with: 'bar'); cr.

Hum, nothing.  I tried your example on PPC Mac OS X (2.3.6 and 2.95f),
i386-linux (2.95f), x86_64-linux (2.95f), and it always worked.  It
printed 4 or 1 depending on the platform -- but it worked.  I also tried

!String methodsFor: 'c callouts'!

strcmp: rhs
     <cCall: 'strcmp' returning: #int args: #(#self #string)>
! !

and it worked well too.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: DLD not working?

Rob Hoelz
Paolo Bonzini <[hidden email]> wrote:

> > DLD addLibrary: 'libc'.
> >
> > !SystemDictionary methodsFor: 'c callouts'!
> > stringCompare: lhs with: rhs
> >     <cCall: 'strcmp' returning: #int args: #(#string #string)>
> > ! !
> >
> > Transcript print: (Smalltalk stringCompare: 'foo' with: 'bar'); cr.
>
> Hum, nothing.  I tried your example on PPC Mac OS X (2.3.6 and
> 2.95f), i386-linux (2.95f), x86_64-linux (2.95f), and it always
> worked.  It printed 4 or 1 depending on the platform -- but it
> worked.  I also tried
>
> !String methodsFor: 'c callouts'!
>
> strcmp: rhs
>      <cCall: 'strcmp' returning: #int args: #(#self #string)>
> ! !
>
> and it worked well too.
>
> Paolo

I tried that second example, but I'm still getting test.st:5: C
function not defined.  Does this mean my Smalltalk was built without
dynamic linking support?  Please let me know if you need any other
information to help us diagnose this problem.

Thanks,
Rob Hoelz


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: DLD not working?

Paolo Bonzini

> I tried that second example, but I'm still getting test.st:5: C
> function not defined.

... which previously you hadn't mentioned. :-)

> Does this mean my Smalltalk was built without
> dynamic linking support?  Please let me know if you need any other
> information to help us diagnose this problem.

Can you please:

1) tell us what system you're on

2) find the libc.la file that GNU Smalltalk installed (or the one that
was produced when building GNU Smalltalk; please tell us whether you
found one installed) and send it to the list.

3) if not found, send the config.log file produced when building GNU
Smalltalk

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk