[Pharo-project] [NativeBoost] pass an array of args to external function
Hi Working with NativeBoost I'm trying to figure out if there is a way I can pass an array of arguments to a function like so: MyExample run: 'echo' args: { 'foo' }. nbRun: str args: args <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( int run_command (String str, Array args) ) module: 'librunner.dylib' The intention is of course to be able to pass arguments to execve() (for example). I guess I could simply parse a string on the C-side but I'd rather not. Any suggestions? Cheers, Max
well, you have to decompose it to fn(arg1, arg2, arg3 ... ) because NB does not supports vararg functions. But if function takes a pointer to array, then you can just use external memory buffer and fill it with anything you want. What exactly function you wanna use? On 6 November 2012 11:06, Max Leske <maxleske@gmail.com> wrote:
Hi
Working with NativeBoost I'm trying to figure out if there is a way I can pass an array of arguments to a function like so:
MyExample run: 'echo' args: { 'foo' }.
nbRun: str args: args <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( int run_command (String str, Array args) ) module: 'librunner.dylib'
The intention is of course to be able to pass arguments to execve() (for example). I guess I could simply parse a string on the C-side but I'd rather not.
Any suggestions?
Cheers, Max
-- Best regards, Igor Stasenko.
Thanks Igor. I meant a pointer to an array, sorry. Here's the function prototype: int run_command(const char *command, char *argv[]); I could then simply pass this to execve like so: status = execve(command, argv, envp); On 06.11.2012, at 15:12, Igor Stasenko <siguctua@gmail.com> wrote:
well, you have to decompose it to fn(arg1, arg2, arg3 ... )
because NB does not supports vararg functions.
But if function takes a pointer to array, then you can just use external memory buffer and fill it with anything you want. What exactly function you wanna use?
On 6 November 2012 11:06, Max Leske <maxleske@gmail.com> wrote:
Hi
Working with NativeBoost I'm trying to figure out if there is a way I can pass an array of arguments to a function like so:
MyExample run: 'echo' args: { 'foo' }.
nbRun: str args: args <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( int run_command (String str, Array args) ) module: 'librunner.dylib'
The intention is of course to be able to pass arguments to execve() (for example). I guess I could simply parse a string on the C-side but I'd rather not.
Any suggestions?
Cheers, Max
-- Best regards, Igor Stasenko.
On 6 November 2012 11:23, Max Leske <maxleske@gmail.com> wrote:
Thanks Igor.
I meant a pointer to an array, sorry. Here's the function prototype:
int run_command(const char *command, char *argv[]);
I could then simply pass this to execve like so:
status = execve(command, argv, envp);
so, like i said, prepare a buffer which will hold strings, i.e. buffer := NativeBoost allocate: (numArgs * 4). arg1ptr := NativeBoost allocate: arg1 size+1. NativeBoost memcopy: arg1 to: arg1ptr size: arg1 size. arg1ptr nbUInt8At: arg1 size put: 0. "terminating null char" buffer nbUInt32At: 0 put: (arg1ptr value). something like that. (and then , of course free memory after you no longer need it :)
On 06.11.2012, at 15:12, Igor Stasenko <siguctua@gmail.com> wrote:
well, you have to decompose it to fn(arg1, arg2, arg3 ... )
because NB does not supports vararg functions.
But if function takes a pointer to array, then you can just use external memory buffer and fill it with anything you want. What exactly function you wanna use?
On 6 November 2012 11:06, Max Leske <maxleske@gmail.com> wrote:
Hi
Working with NativeBoost I'm trying to figure out if there is a way I can pass an array of arguments to a function like so:
MyExample run: 'echo' args: { 'foo' }.
nbRun: str args: args <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( int run_command (String str, Array args) ) module: 'librunner.dylib'
The intention is of course to be able to pass arguments to execve() (for example). I guess I could simply parse a string on the C-side but I'd rather not.
Any suggestions?
Cheers, Max
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
Cool, thanks. I'll give that a try tomorrow. On 06.11.2012, at 18:34, Igor Stasenko <siguctua@gmail.com> wrote:
On 6 November 2012 11:23, Max Leske <maxleske@gmail.com> wrote:
Thanks Igor.
I meant a pointer to an array, sorry. Here's the function prototype:
int run_command(const char *command, char *argv[]);
I could then simply pass this to execve like so:
status = execve(command, argv, envp);
so, like i said, prepare a buffer which will hold strings, i.e.
buffer := NativeBoost allocate: (numArgs * 4). arg1ptr := NativeBoost allocate: arg1 size+1.
NativeBoost memcopy: arg1 to: arg1ptr size: arg1 size. arg1ptr nbUInt8At: arg1 size put: 0. "terminating null char"
buffer nbUInt32At: 0 put: (arg1ptr value).
something like that. (and then , of course free memory after you no longer need it :)
On 06.11.2012, at 15:12, Igor Stasenko <siguctua@gmail.com> wrote:
well, you have to decompose it to fn(arg1, arg2, arg3 ... )
because NB does not supports vararg functions.
But if function takes a pointer to array, then you can just use external memory buffer and fill it with anything you want. What exactly function you wanna use?
On 6 November 2012 11:06, Max Leske <maxleske@gmail.com> wrote:
Hi
Working with NativeBoost I'm trying to figure out if there is a way I can pass an array of arguments to a function like so:
MyExample run: 'echo' args: { 'foo' }.
nbRun: str args: args <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( int run_command (String str, Array args) ) module: 'librunner.dylib'
The intention is of course to be able to pass arguments to execve() (for example). I guess I could simply parse a string on the C-side but I'd rather not.
Any suggestions?
Cheers, Max
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
This is clearly something to add to the documentation of NativeBoost. Igor can you do it? Stef On Nov 6, 2012, at 6:34 PM, Igor Stasenko wrote:
On 6 November 2012 11:23, Max Leske <maxleske@gmail.com> wrote:
Thanks Igor.
I meant a pointer to an array, sorry. Here's the function prototype:
int run_command(const char *command, char *argv[]);
I could then simply pass this to execve like so:
status = execve(command, argv, envp);
so, like i said, prepare a buffer which will hold strings, i.e.
buffer := NativeBoost allocate: (numArgs * 4). arg1ptr := NativeBoost allocate: arg1 size+1.
NativeBoost memcopy: arg1 to: arg1ptr size: arg1 size. arg1ptr nbUInt8At: arg1 size put: 0. "terminating null char"
buffer nbUInt32At: 0 put: (arg1ptr value).
something like that. (and then , of course free memory after you no longer need it :)
On 06.11.2012, at 15:12, Igor Stasenko <siguctua@gmail.com> wrote:
well, you have to decompose it to fn(arg1, arg2, arg3 ... )
because NB does not supports vararg functions.
But if function takes a pointer to array, then you can just use external memory buffer and fill it with anything you want. What exactly function you wanna use?
On 6 November 2012 11:06, Max Leske <maxleske@gmail.com> wrote:
Hi
Working with NativeBoost I'm trying to figure out if there is a way I can pass an array of arguments to a function like so:
MyExample run: 'echo' args: { 'foo' }.
nbRun: str args: args <primitive: #primitiveNativeCall module: #NativeBoostPlugin error: errorCode > ^ self nbCall: #( int run_command (String str, Array args) ) module: 'librunner.dylib'
The intention is of course to be able to pass arguments to execve() (for example). I guess I could simply parse a string on the C-side but I'd rather not.
Any suggestions?
Cheers, Max
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
On 6 November 2012 17:57, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
This is clearly something to add to the documentation of NativeBoost. Igor can you do it?
I already have a description of memory management API for NB in docs. And telling how manage external memory is... ahem.. not really fits into docs :) Maybe a tutor or something. -- Best regards, Igor Stasenko.
On Nov 6, 2012, at 11:06 PM, Igor Stasenko wrote:
On 6 November 2012 17:57, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
This is clearly something to add to the documentation of NativeBoost. Igor can you do it?
I already have a description of memory management API for NB in docs. And telling how manage external memory is... ahem.. not really fits into docs :) Maybe a tutor or something.
think not technical but user! Id o not give a shit if what helps me is called a doc or a tutorial. I care that it helps me fixing my problem. And what I see is that the example of Max is a nice example of a recurring problem people face. Stef
-- Best regards, Igor Stasenko.
Just copy paste the thing you posted in the NBBasicExamples and we're done. A couple of examples which show common problems will help certainly help people to understand. Plus we should convert the examples into tests so they are always run! On 2012-11-07, at 09:28, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
On Nov 6, 2012, at 11:06 PM, Igor Stasenko wrote:
On 6 November 2012 17:57, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
This is clearly something to add to the documentation of NativeBoost. Igor can you do it?
I already have a description of memory management API for NB in docs. And telling how manage external memory is... ahem.. not really fits into docs :) Maybe a tutor or something.
think not technical but user! Id o not give a shit if what helps me is called a doc or a tutorial. I care that it helps me fixing my problem. And what I see is that the example of Max is a nice example of a recurring problem people face.
Stef
-- Best regards, Igor Stasenko.
+ 1 On Nov 7, 2012, at 9:43 AM, Camillo Bruni wrote:
Just copy paste the thing you posted in the NBBasicExamples and we're done. A couple of examples which show common problems will help certainly help people to understand.
Plus we should convert the examples into tests so they are always run!
On 2012-11-07, at 09:28, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
On Nov 6, 2012, at 11:06 PM, Igor Stasenko wrote:
On 6 November 2012 17:57, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
This is clearly something to add to the documentation of NativeBoost. Igor can you do it?
I already have a description of memory management API for NB in docs. And telling how manage external memory is... ahem.. not really fits into docs :) Maybe a tutor or something.
think not technical but user! Id o not give a shit if what helps me is called a doc or a tutorial. I care that it helps me fixing my problem. And what I see is that the example of Max is a nice example of a recurring problem people face.
Stef
-- Best regards, Igor Stasenko.
sure sure.. but guys... i really doubt that i would want to see people poking with NB who don't even have a basic understanding of malloc(ed) memory management and working with memory buffers & pointers. For such sort of people, best what i can offer is "go back when you will learn basics first". Of course, it would be cool if NB could work even for "dummies", but i am thinking , as any technology, before you start using it without shooting yourself into foot, you should do some homework first. On 7 November 2012 08:09, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
+ 1
On Nov 7, 2012, at 9:43 AM, Camillo Bruni wrote:
Just copy paste the thing you posted in the NBBasicExamples and we're done. A couple of examples which show common problems will help certainly help people to understand.
Plus we should convert the examples into tests so they are always run!
On 2012-11-07, at 09:28, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
On Nov 6, 2012, at 11:06 PM, Igor Stasenko wrote:
On 6 November 2012 17:57, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
This is clearly something to add to the documentation of NativeBoost. Igor can you do it?
I already have a description of memory management API for NB in docs. And telling how manage external memory is... ahem.. not really fits into docs :) Maybe a tutor or something.
think not technical but user! Id o not give a shit if what helps me is called a doc or a tutorial. I care that it helps me fixing my problem. And what I see is that the example of Max is a nice example of a recurring problem people face.
Stef
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
I get your point Igor but then again, we're all somewhat self taught which means that as a developer if you don't understand something you hack around until you get it. It's not like I'm going to break anything in the released products, right? And I think I can judge the risk of wrecking my own machine. I think that helping each other out on this list is more important than scowling at the noobs and yelling "DON'T TOUCH". Sorry if that comes across harsh but I'm honestly a little upset. Max On 08.11.2012, at 04:39, Igor Stasenko <siguctua@gmail.com> wrote:
sure sure.. but guys... i really doubt that i would want to see people poking with NB who don't even have a basic understanding of malloc(ed) memory management and working with memory buffers & pointers. For such sort of people, best what i can offer is "go back when you will learn basics first".
Of course, it would be cool if NB could work even for "dummies", but i am thinking , as any technology, before you start using it without shooting yourself into foot, you should do some homework first.
On 7 November 2012 08:09, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
+ 1
On Nov 7, 2012, at 9:43 AM, Camillo Bruni wrote:
Just copy paste the thing you posted in the NBBasicExamples and we're done. A couple of examples which show common problems will help certainly help people to understand.
Plus we should convert the examples into tests so they are always run!
On 2012-11-07, at 09:28, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
On Nov 6, 2012, at 11:06 PM, Igor Stasenko wrote:
On 6 November 2012 17:57, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
This is clearly something to add to the documentation of NativeBoost. Igor can you do it?
I already have a description of memory management API for NB in docs. And telling how manage external memory is... ahem.. not really fits into docs :) Maybe a tutor or something.
think not technical but user! Id o not give a shit if what helps me is called a doc or a tutorial. I care that it helps me fixing my problem. And what I see is that the example of Max is a nice example of a recurring problem people face.
Stef
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
On 8 November 2012 05:42, Max Leske <maxleske@gmail.com> wrote:
I get your point Igor but then again, we're all somewhat self taught which means that as a developer if you don't understand something you hack around until you get it. It's not like I'm going to break anything in the released products, right? And I think I can judge the risk of wrecking my own machine.
I think that helping each other out on this list is more important than scowling at the noobs and yelling "DON'T TOUCH".
nonono.. touch. everything everywhere. i didn't meant to not touch. what i meant that i am not very good at teaching, especially when it is about basics. for me, to explain such things, is like explaining "how to breathe".. and then, as it happens often, i assuming that people know as much as i do :)
Sorry if that comes across harsh but I'm honestly a little upset.
Max
-- Best regards, Igor Stasenko.
On 2012-11-08, at 04:39, Igor Stasenko <siguctua@gmail.com> wrote:
sure sure.. but guys... i really doubt that i would want to see people poking with NB who don't even have a basic understanding of malloc(ed) memory management and working with memory buffers & pointers. For such sort of people, best what i can offer is "go back when you will learn basics first".
that reads for me: everybody but me should use it. And you can be pretty sure that most pharoers (including myself) have a pretty vague notion about malloc/free, combined with the internals of an third party C library, that makes a pretty unstable field. Again, no silver bullets here, but less arrogance and more examples!
Of course, it would be cool if NB could work even for "dummies", but i am thinking , as any technology, before you start using it without shooting yourself into foot, you should do some homework first.
And you can be pretty sure that most pharoers (including myself) have a pretty vague notion about malloc/free, combined with the internals of an third party C library, that makes a pretty unstable field.
Again, no silver bullets here, but less arrogance and more examples!
+1 but we can learn and learn fast with a good tutorial that puts the right amount of information in perspective. Stef
On 11/8/2012 1:30 PM, Stéphane Ducasse wrote:
And you can be pretty sure that most pharoers (including myself) have a pretty vague notion about malloc/free, combined with the internals of an third party C library, that makes a pretty unstable field.
Again, no silver bullets here, but less arrogance and more examples! +1 but we can learn and learn fast with a good tutorial that puts the right amount of information in perspective.
Stef I am aperson who has no background in C or similar languages, but would like to learn how to use NB to be able to access methods in DLLs.
My question is, without becoming a C programmer, what is a sufficient level of knowledge of C to be able to use NB well? What is a good path to acquiring a sufficient level of knowledge? Thanks for any information. Jimmie
jimmie ***THANKS*** I'm in the same situation even if I read several lectures and books on C. So I want a tutorials that takes us into account and I'm sure that this is faisable. Just need care, love and time. STef On Nov 8, 2012, at 8:58 PM, Jimmie Houchin wrote:
On 11/8/2012 1:30 PM, Stéphane Ducasse wrote:
And you can be pretty sure that most pharoers (including myself) have a pretty vague notion about malloc/free, combined with the internals of an third party C library, that makes a pretty unstable field.
Again, no silver bullets here, but less arrogance and more examples! +1 but we can learn and learn fast with a good tutorial that puts the right amount of information in perspective.
Stef I am aperson who has no background in C or similar languages, but would like to learn how to use NB to be able to access methods in DLLs.
My question is, without becoming a C programmer, what is a sufficient level of knowledge of C to be able to use NB well?
What is a good path to acquiring a sufficient level of knowledge?
Thanks for any information.
Jimmie
On 8 November 2012 06:52, Camillo Bruni <camillobruni@gmail.com> wrote:
On 2012-11-08, at 04:39, Igor Stasenko <siguctua@gmail.com> wrote:
sure sure.. but guys... i really doubt that i would want to see people poking with NB who don't even have a basic understanding of malloc(ed) memory management and working with memory buffers & pointers. For such sort of people, best what i can offer is "go back when you will learn basics first".
that reads for me: everybody but me should use it.
oh please... so, the fact that i don't want to explain to you how to use keyboard, or how to send mails, means that only me should use it? But again, if you asking me to teach you how to write emails, but also you cannot type nor even write, should i spend my time teaching you how to write first, and then type, and then use computer, and then finally write emails? I can gladly help with things which really worth helping with. And trust me, memory allocation and pointer operations is what you must know before approaching nativeboost for using it for external libs. I thought that it is obvious to everyone.
And you can be pretty sure that most pharoers (including myself) have a pretty vague notion about malloc/free, combined with the internals of an third party C library, that makes a pretty unstable field.
Again, no silver bullets here, but less arrogance and more examples!
Of course, it would be cool if NB could work even for "dummies", but i am thinking , as any technology, before you start using it without shooting yourself into foot, you should do some homework first.
-- Best regards, Igor Stasenko.
Again I told you several time, do you think that a guy do not understand what is a pointer because he does not know how to write it in C? Give a chance to professionals to learn. We are not talking about explaining what is a pointer, but explaining the potential problems and challenges With your reasoning, I should stop programming because there are so many things that I did not learn in school and I would not have no chance to learn from this community. So with that reasoning I should better stop working in Smalltalk and look for another language! Stef
sure sure.. but guys... i really doubt that i would want to see people poking with NB who don't even have a basic understanding of malloc(ed) memory management and working with memory buffers & pointers. For such sort of people, best what i can offer is "go back when you will learn basics first".
Of course, it would be cool if NB could work even for "dummies", but i am thinking , as any technology, before you start using it without shooting yourself into foot, you should do some homework first.
On 7 November 2012 08:09, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
+ 1
On Nov 7, 2012, at 9:43 AM, Camillo Bruni wrote:
Just copy paste the thing you posted in the NBBasicExamples and we're done. A couple of examples which show common problems will help certainly help people to understand.
Plus we should convert the examples into tests so they are always run!
On 2012-11-07, at 09:28, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
On Nov 6, 2012, at 11:06 PM, Igor Stasenko wrote:
On 6 November 2012 17:57, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
This is clearly something to add to the documentation of NativeBoost. Igor can you do it?
I already have a description of memory management API for NB in docs. And telling how manage external memory is... ahem.. not really fits into docs :) Maybe a tutor or something.
think not technical but user! Id o not give a shit if what helps me is called a doc or a tutorial. I care that it helps me fixing my problem. And what I see is that the example of Max is a nice example of a recurring problem people face.
Stef
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
On 08 Nov 2012, at 20:29, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
I told you several time, do you think that a guy do not understand what is a pointer because he does not know how to write it in C? Give a chance to professionals to learn. We are not talking about explaining what is a pointer, but explaining the potential problems and challenges
With your reasoning, I should stop programming because there are so many things that I did not learn in school and I would not have no chance to learn from this community. So with that reasoning I should better stop working in Smalltalk and look for another language!
I think he meant it as a general warning ;-) The things is, as long as its pure Smalltalk, you are protected by a very good dynamic type system that cannot really be broken, i.e. the object illusion is kept (bounds checking, blah blah â¦) But once you start using C pointers, you can very easily do something wrong. It might be a very subtle error and it might not manifest itself immediately, alas there won't be a Debugger popping up, just a coredump. Pharo is actually pretty/very stable in day to day use, it should stay that way. Sven -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
On Nov 8, 2012, at 9:13 PM, Sven Van Caekenberghe wrote:
On 08 Nov 2012, at 20:29, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
I told you several time, do you think that a guy do not understand what is a pointer because he does not know how to write it in C? Give a chance to professionals to learn. We are not talking about explaining what is a pointer, but explaining the potential problems and challenges
With your reasoning, I should stop programming because there are so many things that I did not learn in school and I would not have no chance to learn from this community. So with that reasoning I should better stop working in Smalltalk and look for another language!
I think he meant it as a general warning ;-)
yes I know
The things is, as long as its pure Smalltalk, you are protected by a very good dynamic type system that cannot really be broken, i.e. the object illusion is kept (bounds checking, blah blah â¦)
indeed but this means that with a little care we should be able to explain points. I do not see them as difficult, just full of little details.
But once you start using C pointers, you can very easily do something wrong. It might be a very subtle error and it might not manifest itself immediately, alas there won't be a Debugger popping up, just a coredump.
Pharo is actually pretty/very stable in day to day use, it should stay that way.
oh! yes! Stef
Sven
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
On 8 November 2012 17:13, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 08 Nov 2012, at 20:29, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
I told you several time, do you think that a guy do not understand what is a pointer because he does not know how to write it in C? Give a chance to professionals to learn. We are not talking about explaining what is a pointer, but explaining the potential problems and challenges
With your reasoning, I should stop programming because there are so many things that I did not learn in school and I would not have no chance to learn from this community. So with that reasoning I should better stop working in Smalltalk and look for another language!
I think he meant it as a general warning ;-)
The things is, as long as its pure Smalltalk, you are protected by a very good dynamic type system that cannot really be broken, i.e. the object illusion is kept (bounds checking, blah blah â¦)
But once you start using C pointers, you can very easily do something wrong. It might be a very subtle error and it might not manifest itself immediately, alas there won't be a Debugger popping up, just a coredump.
Pharo is actually pretty/very stable in day to day use, it should stay that way.
yes, that what i meant. and without some practice in C, you are really lacking understanding that pointers is actually a mine field: one day you can walk safely, another day be blown up at first step. and referencing "for dummies" was a popular books series like "windows for dummies" , etc, but not in a sense to show arrogance and disrespect to Max. Sorry Max, if that offended you. So, what i meant to say, there is certainty will be no such book like "NativeBoost for dummies". You cannot enter this field without having certain background or preparation.
Sven
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
-- Best regards, Igor Stasenko.
On 09.11.2012, at 11:13, Igor Stasenko <siguctua@gmail.com> wrote:
On 8 November 2012 17:13, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 08 Nov 2012, at 20:29, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
I told you several time, do you think that a guy do not understand what is a pointer because he does not know how to write it in C? Give a chance to professionals to learn. We are not talking about explaining what is a pointer, but explaining the potential problems and challenges
With your reasoning, I should stop programming because there are so many things that I did not learn in school and I would not have no chance to learn from this community. So with that reasoning I should better stop working in Smalltalk and look for another language!
I think he meant it as a general warning ;-)
The things is, as long as its pure Smalltalk, you are protected by a very good dynamic type system that cannot really be broken, i.e. the object illusion is kept (bounds checking, blah blah â¦)
But once you start using C pointers, you can very easily do something wrong. It might be a very subtle error and it might not manifest itself immediately, alas there won't be a Debugger popping up, just a coredump.
Pharo is actually pretty/very stable in day to day use, it should stay that way.
yes, that what i meant. and without some practice in C, you are really lacking understanding that pointers is actually a mine field: one day you can walk safely, another day be blown up at first step.
and referencing "for dummies" was a popular books series like "windows for dummies" , etc, but not in a sense to show arrogance and disrespect to Max. Sorry Max, if that offended you.
Thanks Igor, apology accepted.
So, what i meant to say, there is certainty will be no such book like "NativeBoost for dummies". You cannot enter this field without having certain background or preparation.
Agreed. I think we can close this topic now :) Cheers, Max
Sven
-- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill
-- Best regards, Igor Stasenko.
Just to make it clear (to everyone): if you first asking me how to call a function which takes array of pointers, the question won't left without answer. but if your next question after my answer is "what is array of pointers" ... sorry , but you can keep me as arrogant nerd, but i won't answer it. -- Best regards, Igor Stasenko.
Igor I think that the approach of camillo is the right one. Examples, examples, examples and a bit more of working examples. Stef On Nov 9, 2012, at 11:49 AM, Igor Stasenko wrote:
Just to make it clear (to everyone): if you first asking me how to call a function which takes array of pointers, the question won't left without answer. but if your next question after my answer is "what is array of pointers" ... sorry , but you can keep me as arrogant nerd, but i won't answer it.
-- Best regards, Igor Stasenko.
On 9 November 2012 16:18, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Igor I think that the approach of camillo is the right one. Examples, examples, examples and a bit more of working examples.
I agree. P.S. Sorry guys it was a tough day for me. Sleepless night + sick + presentation..
Stef
-- Best regards, Igor Stasenko.
On Nov 10, 2012, at 1:02 AM, Igor Stasenko wrote:
On 9 November 2012 16:18, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Igor I think that the approach of camillo is the right one. Examples, examples, examples and a bit more of working examples.
I agree.
P.S. Sorry guys it was a tough day for me. Sleepless night + sick + presentation..
Ouch rest!!! enjoy the sun here it is not sunny. Stef
Stef
-- Best regards, Igor Stasenko.
Igor Stasenko wrote:
On 8 November 2012 17:13, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 08 Nov 2012, at 20:29, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
I told you several time, do you think that a guy do not understand what is a pointer because he does not know how to write it in C? Give a chance to professionals to learn. We are not talking about explaining what is a pointer, but explaining the potential problems and challenges
But once you start using C pointers, you can very easily do something wrong. It might be a very subtle error and it might not manifest itself immediately, alas there won't be a Debugger popping up, just a coredump.
yes, that what i meant. and without some practice in C, you are really lacking understanding that pointers is actually a mine field: one day you can walk safely, another day be blown up at first step.
With the proviso that I haven't programmed in C for a long time, and that the publication date is 1994, I would recommend the book "Expert C Programming: Deep C Secrets" [2] for intermediate level programmers to learn more about the intricacies of pointers versus arrays, automatic type promotion, deciphering declarations - which are some of the things that I guess are particularly important for interfacing between languages. One great thing is that the book is _very_ readable, with humorous anecdotes scattered amongst the technical material. I have put together a couple of sample pages [2] for review. I am unable to tell how dated some of the material is, so I would be happy to donate a copy as a community contribution*, which might be posted between interested parties. Kind of a community library that helps people communicate at a common level. If it helps grow the number of people working at that level interfacing with external libraries, then ultimately that benefits me also. *Unless someone can recommend another book, since there must be many more good ones since then. [1] http://www.amazon.com/Expert-Programming-Peter-van-Linden/product-reviews/01... [2] http://files.openinworld.com/misc/ExpertCProgramming-Sample.pdf cheers -ben
participants (7)
-
Ben Coman -
Camillo Bruni -
Igor Stasenko -
Jimmie Houchin -
Max Leske -
Stéphane Ducasse -
Sven Van Caekenberghe