Um, you realize you're writing right into a random memory location? If
you're not an experienced C programmer, you may want to reconsider your
project to write a Ruby extension.
I guess your problem is that buf is an uninitialized pointer pointing to an
arbitrary memory location. If you declare it like this
char buf[200]
your program should work.
Um, you realize you're writing right into a random memory location? If
you're not an experienced C programmer, you may want to reconsider your
project to write a Ruby extension.
I am not an experienced C programmer,and just learn to write a Ruby
extension with c.
I guess your problem is that buf is an uninitialized pointer pointing to
an
arbitrary memory location. If you declare it like this
char buf[200]
your program should work.
I consider myself a reasonably experienced C programmer, and I'd still
want to be sure I was brushed up and current before trying to write an
extension plugin. Even in a well-planned environment, writing plugins
is on the heavy-duty end.
Seriously, just don't. Hire someone. Write it in pure Ruby.
Or... Budget 3-6 months to learn C well enough to do it competently.
-s
···
In message <f025162e5afe1e9c3304d79581fc4f24@ruby-forum.com>, Haoqi Haoqi writes:
I am not an experienced C programmer,and just learn to write a Ruby
extension with c.
I'll disagree somewhat here. There are things C does much faster than Ruby
does. Application performance is not everything, but there are cases where
moving code to a C extension makes the difference between being able to use
ruby and not being able to.
Writing an extension in C is, to me, much easier than learning C by itself,
because there are a bunch of things that you can let ruby handle that are
just a pain in C (mainly I/O things).
···
On 5/1/07, Peter Seebach <seebs@seebs.net> wrote:
In message <f025162e5afe1e9c3304d79581fc4f24@ruby-forum.com>, Haoqi Haoqi > writes:
>I am not an experienced C programmer,and just learn to write a Ruby
>extension with c.
Don't.
I consider myself a reasonably experienced C programmer, and I'd still
want to be sure I was brushed up and current before trying to write an
extension plugin. Even in a well-planned environment, writing plugins
is on the heavy-duty end.
Seriously, just don't. Hire someone. Write it in pure Ruby.
Or... Budget 3-6 months to learn C well enough to do it competently.