mac address on windows
Hello, Has anyone tried to retrieve MAC address(es) of a windows machine using Pharo? I have tried two options thus far without any success: 1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output. This opens a command prompt on windows machine without anything happening inside it. Although when I try it on Linux/Mac (with ifconfig), I retrieve the output of the command. Another option is to do OSProcess command: 'ipconfig' but I wasn't able to find a way to retrieve the output of the command. 2/ Nativeboost comes with a set of built-in command to interact with Windows (class NBWin32Shell). One can get environment variables, etc. But I wasn't able to find a way to execute a command on the line and get the results. Would someone know of a way to retrieve the MAC addresses in Windows through the way listed above or any other form from the Pharo image? thanks in advance, Usman
looks like a bit of C code is required. http://stackoverflow.com/questions/13646621/how-to-get-mac-address-in-window... Maybe a good time to put the C code generator to the test. Phil Le 2 mai 2015 15:55, "Usman Bhatti" <usman.bhatti@gmail.com> a écrit :
Hello,
Has anyone tried to retrieve MAC address(es) of a windows machine using Pharo? I have tried two options thus far without any success:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output. This opens a command prompt on windows machine without anything happening inside it. Although when I try it on Linux/Mac (with ifconfig), I retrieve the output of the command. Another option is to do OSProcess command: 'ipconfig' but I wasn't able to find a way to retrieve the output of the command.
2/ Nativeboost comes with a set of built-in command to interact with Windows (class NBWin32Shell). One can get environment variables, etc. But I wasn't able to find a way to execute a command on the line and get the results.
Would someone know of a way to retrieve the MAC addresses in Windows through the way listed above or any other form from the Pharo image?
thanks in advance,
Usman
Yes, I already started exploring this path but there are few a problems that I'll share in another thread. On Sat, May 2, 2015 at 4:43 PM, phil@highoctane.be <phil@highoctane.be> wrote:
looks like a bit of C code is required.
http://stackoverflow.com/questions/13646621/how-to-get-mac-address-in-window...
Maybe a good time to put the C code generator to the test.
Phil Le 2 mai 2015 15:55, "Usman Bhatti" <usman.bhatti@gmail.com> a écrit :
Hello,
Has anyone tried to retrieve MAC address(es) of a windows machine using Pharo? I have tried two options thus far without any success:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output. This opens a command prompt on windows machine without anything happening inside it. Although when I try it on Linux/Mac (with ifconfig), I retrieve the output of the command. Another option is to do OSProcess command: 'ipconfig' but I wasn't able to find a way to retrieve the output of the command.
2/ Nativeboost comes with a set of built-in command to interact with Windows (class NBWin32Shell). One can get environment variables, etc. But I wasn't able to find a way to execute a command on the line and get the results.
Would someone know of a way to retrieve the MAC addresses in Windows through the way listed above or any other form from the Pharo image?
thanks in advance,
Usman
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo. Pierce
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper. I loaded it with: Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load. But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated: http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated: http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille). I also tried to perform the nativeboost call by creating my structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong. With ProcessWrapper, I could not load the classes essential for making the plugin work. HTH, Usman On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated: http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way! Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI Would NativeBoost work with your dll? Should. I also tried to perform the nativeboost call by creating my structures in
Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications? Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures in
Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN: typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... } So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image). usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures in
Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look. btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
Hi Nicolai, Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version). Attached also the DLL referenced in the code. On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures
in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
I've loaded your package. A prerequisite is to load OS-Window to make it work. I've got the DLL call working nicely and the nativeboost with the structure freezing. Now, we should all have a look at: https://github.com/ronsaldo/bullet-pharo and https://github.com/ronsaldo/swig because it looks like the way to go to wrap libraries... Ronie, I know you modified swig for generating Pharo code; Is cloning your swig repo the way to go ? Phil On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures
in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
2015-05-06 12:10 GMT+02:00 phil@highoctane.be <phil@highoctane.be>:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
I've got the DLL call working nicely and the nativeboost with the structure freezing.
This is because you have a recursive datastructure description, but acutually the IP_ADAPTER_INFO structure is not recursive: PIP_ADAPTER_INFO class >>fieldsDex ^ #( PIP_ADAPTER_INFO nextVariable; DWORD ComboIndex; CHAR AdapterName; CHAR Description; ....) The "nextVariable" should be a pointer to the structure. from MSDN: struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; "<- pointer" DWORD ComboIndex; char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; UINT AddressLength; ....
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures
in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com
wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
On 06 May 2015, at 12:29 , Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 12:10 GMT+02:00 phil@highoctane.be <mailto:phil@highoctane.be> <phil@highoctane.be <mailto:phil@highoctane.be>>: I've loaded your package.
A prerequisite is to load OS-Window to make it work.
I've got the DLL call working nicely and the nativeboost with the structure freezing.
This is because you have a recursive datastructure description, but acutually the IP_ADAPTER_INFO structure is not recursive:
PIP_ADAPTER_INFO class >>fieldsDex ^ #( PIP_ADAPTER_INFO nextVariable; DWORD ComboIndex; CHAR AdapterName; CHAR Description; ....)
The "nextVariable" should be a pointer to the structure.
from MSDN:
struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; "<- pointer" DWORD ComboIndex; char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; UINT AddressLength;
....
Also, the pOutBufLen parameter to GetAdaptorInfo is supposed to be a pointer to an unsigned long, holding the size of the buffer. Setting that to an int in the NB declaration, will cause all sorts of trouble... Cheers, Henry
On Wed, May 6, 2015 at 12:29 PM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 12:10 GMT+02:00 phil@highoctane.be <phil@highoctane.be>:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
I've got the DLL call working nicely and the nativeboost with the structure freezing.
This is because you have a recursive datastructure description, but acutually the IP_ADAPTER_INFO structure is not recursive:
PIP_ADAPTER_INFO class >>fieldsDex ^ #( PIP_ADAPTER_INFO nextVariable; DWORD ComboIndex; CHAR AdapterName; CHAR Description; ....)
The "nextVariable" should be a pointer to the structure.
from MSDN:
struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; "<- pointer" DWORD ComboIndex; char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; UINT AddressLength;
....
So, what's to put in there then? I can use FFI / NB for basic cases but never ventured into those structure. I'd like to :-) Phil I
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be
wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my
structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main '; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
2015-05-06 13:38 GMT+02:00 phil@highoctane.be <phil@highoctane.be>:
On Wed, May 6, 2015 at 12:29 PM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 12:10 GMT+02:00 phil@highoctane.be <phil@highoctane.be>:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
I've got the DLL call working nicely and the nativeboost with the structure freezing.
This is because you have a recursive datastructure description, but acutually the IP_ADAPTER_INFO structure is not recursive:
PIP_ADAPTER_INFO class >>fieldsDex ^ #( PIP_ADAPTER_INFO nextVariable; DWORD ComboIndex; CHAR AdapterName; CHAR Description; ....)
The "nextVariable" should be a pointer to the structure.
from MSDN:
struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; "<- pointer" DWORD ComboIndex; char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; UINT AddressLength;
....
So, what's to put in there then?
IpAdapterInfo class>>#fieldsDesc ^#( IpAdapterInfo* Next; DWORD ComboIndex; .... This would work
I can use FFI / NB for basic cases but never ventured into those structure. I'd like to :-)
Phil I
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be < phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com
wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my
structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main '; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
On 06 May 2015, at 12:10, phil@highoctane.be wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4 Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo <https://github.com/ronsaldo/bullet-pharo>
and
https://github.com/ronsaldo/swig <https://github.com/ronsaldo/swig>
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote: Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de <mailto:nicolaihess@web.de>> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <mailto:phil@highoctane.be> <phil@highoctane.be <mailto:phil@highoctane.be>> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote: I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFOÂ <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com <mailto:btc@openinworld.com>> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm <https://github.com/pharo-project/pharo-vm> cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com <mailto:pierce@samadhiweb.com>> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper <http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper> successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main <http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main>'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated: http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/ <http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/>
Pierce
2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
On 06 May 2015, at 12:10, phil@highoctane.be wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4
OS-Windows (by TorstenBergmann) not OSWindow :) It is needed for the shared pool WinTypes, but without OS-Window, he can use NBWinTypes instead.
Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures
in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com <mailto:estebanlm@gmail.com>>:
On 06 May 2015, at 12:10, phil@highoctane.be <mailto:phil@highoctane.be> wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4
OS-Windows (by TorstenBergmann) not OSWindow :)
ahhh. Name clash :)
It is needed for the shared pool WinTypes, but without OS-Window, he can use NBWinTypes instead.
Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo <https://github.com/ronsaldo/bullet-pharo>
and
https://github.com/ronsaldo/swig <https://github.com/ronsaldo/swig>
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote: Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de <mailto:nicolaihess@web.de>> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <mailto:phil@highoctane.be> <phil@highoctane.be <mailto:phil@highoctane.be>> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote: I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFOÂ <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com <mailto:btc@openinworld.com>> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm <https://github.com/pharo-project/pharo-vm> cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com <mailto:pierce@samadhiweb.com>> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper <http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper> successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main <http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main>'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated: http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/ <http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/>
Pierce
A few easily fixed Type/pointers to Types mixups, and a slipup where two different classes are confused for the same aside, the real show stopper, if I haven't missed something entirely, is that the struct parser/NB in general does not handle const sized arrays*, which is used in a few of the required structs. Extending the parser should be relatively straight forward, along the lines of adding stream peek: #'[' ifTrue: [stream next. type := SizedExternalArrayType type: type size: stream next. stream next = #']' ifFalse: [self error: 'Missing closing bracket for ', type printString]] to NBExtenralStructureFields >> #parseFields:... after the name is read. Coding SizedExternalArrayType is a bit more work though... Cheers, Henry *The end goal would be to be able to generate accessors/read/write for a simple test-struct such as #fieldsDesc ^#( char ip[MyClassVar +2]; ) On Wed, May 6, 2015 at 5:28 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
On 06 May 2015, at 12:10, phil@highoctane.be wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4
OS-Windows (by TorstenBergmann)
not OSWindow :)
ahhh. Name clash :)
It is needed for the shared pool WinTypes, but without OS-Window, he can use NBWinTypes instead.
Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be
wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my
structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
2015-05-06 22:47 GMT+02:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
A few easily fixed Type/pointers to Types mixups, and a slipup where two different classes are confused for the same aside, the real show stopper, if I haven't missed something entirely, is that the struct parser/NB in general does not handle const sized arrays*, which is used in a few of the required structs.
Extending the parser should be relatively straight forward, along the lines of adding stream peek: #'[' ifTrue: [stream next. type := SizedExternalArrayType type: type size: stream next. stream next = #']' ifFalse: [self error: 'Missing closing bracket for ', type printString]] to NBExtenralStructureFields >> #parseFields:... after the name is read.
Coding SizedExternalArrayType is a bit more work though...
Cheers, Henry
*The end goal would be to be able to generate accessors/read/write for a simple test-struct such as #fieldsDesc ^#( char ip[MyClassVar +2]; )
Yes, a parser for this would be great. I tried it with a little hack NBExternalStructure subclass: #Char_260 ... Char_260 class>>#fieldDesc ^ #(char data) Char_260 class>>instanceSize ^ 260 You need another accessor for accessing the data, otherwise you'll only get the first char. AND I don't know how the external memory is handle, probably it is never freed :) Now a complete example (attached code) call it with GetMacWin32 getMacAddress
On Wed, May 6, 2015 at 5:28 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
On 06 May 2015, at 12:10, phil@highoctane.be wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4
OS-Windows (by TorstenBergmann)
not OSWindow :)
ahhh. Name clash :)
It is needed for the shared pool WinTypes, but without OS-Window, he can use NBWinTypes instead.
Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be < phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com
wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my
structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com
wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
Ups, one method was in the *generated-code-protocol and will be removed on package load. You need to add the method BYTE_8>>asString ^ self address hex 2015-05-07 1:06 GMT+02:00 Nicolai Hess <nicolaihess@web.de>:
2015-05-06 22:47 GMT+02:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
A few easily fixed Type/pointers to Types mixups, and a slipup where two different classes are confused for the same aside, the real show stopper, if I haven't missed something entirely, is that the struct parser/NB in general does not handle const sized arrays*, which is used in a few of the required structs.
Extending the parser should be relatively straight forward, along the lines of adding stream peek: #'[' ifTrue: [stream next. type := SizedExternalArrayType type: type size: stream next. stream next = #']' ifFalse: [self error: 'Missing closing bracket for ', type printString]] to NBExtenralStructureFields >> #parseFields:... after the name is read.
Coding SizedExternalArrayType is a bit more work though...
Cheers, Henry
*The end goal would be to be able to generate accessors/read/write for a simple test-struct such as #fieldsDesc ^#( char ip[MyClassVar +2]; )
Yes, a parser for this would be great.
I tried it with a little hack
NBExternalStructure subclass: #Char_260 ...
Char_260 class>>#fieldDesc ^ #(char data)
Char_260 class>>instanceSize ^ 260
You need another accessor for accessing the data, otherwise you'll only get the first char. AND I don't know how the external memory is handle, probably it is never freed :)
Now a complete example (attached code) call it with GetMacWin32 getMacAddress
On Wed, May 6, 2015 at 5:28 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
On 06 May 2015, at 12:10, phil@highoctane.be wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4
OS-Windows (by TorstenBergmann)
not OSWindow :)
ahhh. Name clash :)
It is needed for the shared pool WinTypes, but without OS-Window, he can use NBWinTypes instead.
Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be < phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my
structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
On Thu, May 7, 2015 at 1:06 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 22:47 GMT+02:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
A few easily fixed Type/pointers to Types mixups, and a slipup where two different classes are confused for the same aside, the real show stopper, if I haven't missed something entirely, is that the struct parser/NB in general does not handle const sized arrays*, which is used in a few of the required structs.
Extending the parser should be relatively straight forward, along the lines of adding stream peek: #'[' ifTrue: [stream next. type := SizedExternalArrayType type: type size: stream next. stream next = #']' ifFalse: [self error: 'Missing closing bracket for ', type printString]] to NBExtenralStructureFields >> #parseFields:... after the name is read.
Coding SizedExternalArrayType is a bit more work though...
Cheers, Henry
*The end goal would be to be able to generate accessors/read/write for a simple test-struct such as #fieldsDesc ^#( char ip[MyClassVar +2]; )
Yes, a parser for this would be great.
I tried it with a little hack
NBExternalStructure subclass: #Char_260 ...
Char_260 class>>#fieldDesc ^ #(char data)
Char_260 class>>instanceSize ^ 260
You need another accessor for accessing the data, otherwise you'll only get the first char. AND I don't know how the external memory is handle, probably it is never freed :)
Now a complete example (attached code) call it with GetMacWin32 getMacAddress
Code loads fine on my 3.0 But hiccup on: resolveType: aTypeName " a type name could be - a class variable name - a class name - a type name - a type name, followed by arbitrary number pointer chars - $*" | name newName resolver binding ptrArity | newName := aTypeName. ptrArity := 0. "resolve aliases and pointers" [ name := newName trimRight. <<<--------------- HERE - as newName is a subclass of NBExternalStructure, so no trimRight newName := self aliasForType: name. newName last = $* ifTrue: [ ptrArity := ptrArity + 1. newName := newName allButLast ]. name = newName ] whileFalse. I changed to name := newName asString trimRight. Call worked then but output gives this: GetMacWin32 getMacAddress 'BYTE_8 ( data: $¼ <-- some weird string here )' Also, I wonder why you call the primGet... twice getMacAddressOf: iInterface | ptr ptr2 nul ret | ptr := NativeBoost allocate: 4. nul := NativeBoost allocate: 0. ptr nbUInt32AtOffset: 0 put: 0. ret := self primGetAdaptersInfo: nul length: ptr. ret = 111 "ERROR_BUFFER_OVERFLOW" ifTrue: [ | size | size := ptr nbUInt32AtOffset: 0. ptr2 := NativeBoost allocate: size. ret := self primGetAdaptersInfo: ptr2 length: ptr. ret = 0 "NO_ERROR" ifTrue: [ | pip numberOfInterfaces| numberOfInterfaces := size / IpAdapterInfo instanceSize. (iInterface between:1 and: numberOfInterfaces) ifFalse:[ ^ nil]. pip := (NBExternalArray ofType: IpAdapterInfo) onAddress: ptr2 size: numberOfInterfaces. ^ (pip at:iInterface ) Address asString]]. ^ nil Phil
On Wed, May 6, 2015 at 5:28 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
On 06 May 2015, at 12:10, phil@highoctane.be wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4
OS-Windows (by TorstenBergmann)
not OSWindow :)
ahhh. Name clash :)
It is needed for the shared pool WinTypes, but without OS-Window, he can use NBWinTypes instead.
Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be < phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my
structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
-- --- Philippe Back Visible Performance Improvements Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027 Mail:phil@highoctane.be | Web: http://philippeback.eu Blog: http://philippeback.be | Twitter: @philippeback Youtube: http://www.youtube.com/user/philippeback/videos High Octane SPRL rue cour Boisacq 101 | 1301 Bierges | Belgium Pharo Consortium Member - http://consortium.pharo.org/ Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller
Hi Nicolas, Thank you for looking at the code. I was away and could not try your code. On Thu, May 7, 2015 at 9:27 AM, phil@highoctane.be <phil@highoctane.be> wrote:
On Thu, May 7, 2015 at 1:06 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 22:47 GMT+02:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
A few easily fixed Type/pointers to Types mixups, and a slipup where two different classes are confused for the same aside, the real show stopper, if I haven't missed something entirely, is that the struct parser/NB in general does not handle const sized arrays*, which is used in a few of the required structs.
Extending the parser should be relatively straight forward, along the lines of adding stream peek: #'[' ifTrue: [stream next. type := SizedExternalArrayType type: type size: stream next. stream next = #']' ifFalse: [self error: 'Missing closing bracket for ', type printString]] to NBExtenralStructureFields >> #parseFields:... after the name is read.
Coding SizedExternalArrayType is a bit more work though...
Cheers, Henry
*The end goal would be to be able to generate accessors/read/write for a simple test-struct such as #fieldsDesc ^#( char ip[MyClassVar +2]; )
Yes, a parser for this would be great.
I tried it with a little hack
NBExternalStructure subclass: #Char_260 ...
Char_260 class>>#fieldDesc ^ #(char data)
Char_260 class>>instanceSize ^ 260
You need another accessor for accessing the data, otherwise you'll only get the first char. AND I don't know how the external memory is handle, probably it is never freed :)
Now a complete example (attached code) call it with GetMacWin32 getMacAddress
Code loads fine on my 3.0
same here.
But hiccup on:
resolveType: aTypeName " a type name could be - a class variable name - a class name - a type name - a type name, followed by arbitrary number pointer chars - $*"
| name newName resolver binding ptrArity | newName := aTypeName. ptrArity := 0. "resolve aliases and pointers" [ name := newName trimRight. <<<--------------- HERE - as newName is a subclass of NBExternalStructure, so no trimRight newName := self aliasForType: name. newName last = $* ifTrue: [ ptrArity := ptrArity + 1. newName := newName allButLast ]. name = newName ] whileFalse.
I changed to name := newName asString trimRight.
this worked for me.
Call worked then but output gives this:
GetMacWin32 getMacAddress 'BYTE_8 ( data: $¼ <-- some weird string here )'
It worked for me, I didn't encounter the problem of strange characters. I get: 000c29ab70960000 The last 4 trailing zeros are not the part of the mac address and I am not sure why these are getting added. I'll have a look at your code. thanks again. usman
Also, I wonder why you call the primGet... twice
getMacAddressOf: iInterface | ptr ptr2 nul ret | ptr := NativeBoost allocate: 4. nul := NativeBoost allocate: 0. ptr nbUInt32AtOffset: 0 put: 0. ret := self primGetAdaptersInfo: nul length: ptr. ret = 111 "ERROR_BUFFER_OVERFLOW" ifTrue: [ | size | size := ptr nbUInt32AtOffset: 0. ptr2 := NativeBoost allocate: size. ret := self primGetAdaptersInfo: ptr2 length: ptr. ret = 0 "NO_ERROR" ifTrue: [ | pip numberOfInterfaces| numberOfInterfaces := size / IpAdapterInfo instanceSize. (iInterface between:1 and: numberOfInterfaces) ifFalse:[ ^ nil]. pip := (NBExternalArray ofType: IpAdapterInfo) onAddress: ptr2 size: numberOfInterfaces. ^ (pip at:iInterface ) Address asString]]. ^ nil
Phil
On Wed, May 6, 2015 at 5:28 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
On 06 May 2015, at 12:10, phil@highoctane.be wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4
OS-Windows (by TorstenBergmann)
not OSWindow :)
ahhh. Name clash :)
It is needed for the shared pool WinTypes, but without OS-Window, he can use NBWinTypes instead.
Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be < phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my
structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main '; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
-- --- Philippe Back Visible Performance Improvements Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027 Mail:phil@highoctane.be | Web: http://philippeback.eu Blog: http://philippeback.be | Twitter: @philippeback Youtube: http://www.youtube.com/user/philippeback/videos
High Octane SPRL rue cour Boisacq 101 | 1301 Bierges | Belgium
Pharo Consortium Member - http://consortium.pharo.org/ Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller
I had a #asString method in the BYTE_8 class that I put by accident in the *generated-code... protocol This method will be removed if the generated methods are regenerated. Just add a new method: BYTE_8>>asString ^ self address hex The address has 8 bytes because this is the max number of bytes reserved for the address. The IP_ADAPTER_INFO struct has a field for the actually used number of bytes. You can read that field and just read this number of bytes. 2015-05-12 21:32 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
Hi Nicolas,
Thank you for looking at the code. I was away and could not try your code.
On Thu, May 7, 2015 at 9:27 AM, phil@highoctane.be <phil@highoctane.be> wrote:
On Thu, May 7, 2015 at 1:06 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 22:47 GMT+02:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
A few easily fixed Type/pointers to Types mixups, and a slipup where two different classes are confused for the same aside, the real show stopper, if I haven't missed something entirely, is that the struct parser/NB in general does not handle const sized arrays*, which is used in a few of the required structs.
Extending the parser should be relatively straight forward, along the lines of adding stream peek: #'[' ifTrue: [stream next. type := SizedExternalArrayType type: type size: stream next. stream next = #']' ifFalse: [self error: 'Missing closing bracket for ', type printString]] to NBExtenralStructureFields >> #parseFields:... after the name is read.
Coding SizedExternalArrayType is a bit more work though...
Cheers, Henry
*The end goal would be to be able to generate accessors/read/write for a simple test-struct such as #fieldsDesc ^#( char ip[MyClassVar +2]; )
Yes, a parser for this would be great.
I tried it with a little hack
NBExternalStructure subclass: #Char_260 ...
Char_260 class>>#fieldDesc ^ #(char data)
Char_260 class>>instanceSize ^ 260
You need another accessor for accessing the data, otherwise you'll only get the first char. AND I don't know how the external memory is handle, probably it is never freed :)
Now a complete example (attached code) call it with GetMacWin32 getMacAddress
Code loads fine on my 3.0
same here.
But hiccup on:
resolveType: aTypeName " a type name could be - a class variable name - a class name - a type name - a type name, followed by arbitrary number pointer chars - $*"
| name newName resolver binding ptrArity | newName := aTypeName. ptrArity := 0. "resolve aliases and pointers" [ name := newName trimRight. <<<--------------- HERE - as newName is a subclass of NBExternalStructure, so no trimRight newName := self aliasForType: name. newName last = $* ifTrue: [ ptrArity := ptrArity + 1. newName := newName allButLast ]. name = newName ] whileFalse.
I changed to name := newName asString trimRight.
this worked for me.
Call worked then but output gives this:
GetMacWin32 getMacAddress 'BYTE_8 ( data: $¼ <-- some weird string here )'
It worked for me, I didn't encounter the problem of strange characters. I get: 000c29ab70960000 The last 4 trailing zeros are not the part of the mac address and I am not sure why these are getting added. I'll have a look at your code.
thanks again.
usman
Also, I wonder why you call the primGet... twice
getMacAddressOf: iInterface | ptr ptr2 nul ret | ptr := NativeBoost allocate: 4. nul := NativeBoost allocate: 0. ptr nbUInt32AtOffset: 0 put: 0. ret := self primGetAdaptersInfo: nul length: ptr. ret = 111 "ERROR_BUFFER_OVERFLOW" ifTrue: [ | size | size := ptr nbUInt32AtOffset: 0. ptr2 := NativeBoost allocate: size. ret := self primGetAdaptersInfo: ptr2 length: ptr. ret = 0 "NO_ERROR" ifTrue: [ | pip numberOfInterfaces| numberOfInterfaces := size / IpAdapterInfo instanceSize. (iInterface between:1 and: numberOfInterfaces) ifFalse:[ ^ nil]. pip := (NBExternalArray ofType: IpAdapterInfo) onAddress: ptr2 size: numberOfInterfaces. ^ (pip at:iInterface ) Address asString]]. ^ nil
Phil
On Wed, May 6, 2015 at 5:28 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
On 06 May 2015, at 17:03, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 16:40 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
On 06 May 2015, at 12:10, phil@highoctane.be wrote:
I've loaded your package.
A prerequisite is to load OS-Window to make it work.
why? in any case, oswindow is already included in pharo4
OS-Windows (by TorstenBergmann)
not OSWindow :)
ahhh. Name clash :)
It is needed for the shared pool WinTypes, but without OS-Window, he can use NBWinTypes instead.
Esteban
I've got the DLL call working nicely and the nativeboost with the structure freezing.
Now, we should all have a look at:
https://github.com/ronsaldo/bullet-pharo
and
https://github.com/ronsaldo/swig
because it looks like the way to go to wrap libraries...
Ronie, I know you modified swig for generating Pharo code;
Is cloning your swig repo the way to go ?
Phil
On Wed, May 6, 2015 at 10:39 AM, Usman Bhatti <usman.bhatti@gmail.com
wrote:
Hi Nicolai,
Here is my package that defines the nativeboost call and associated C structs. The external C struct is self referencing and hence sometimes I get infinite recursion when trying to change field descriptions. That is the reason why the automatically generated accessors are absent (although I had them in an earlier version).
Attached also the DLL referenced in the code.
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be < phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my
structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote: As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti < usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote: On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main '; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
-- --- Philippe Back Visible Performance Improvements Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027 Mail:phil@highoctane.be | Web: http://philippeback.eu Blog: http://philippeback.be | Twitter: @philippeback Youtube: http://www.youtube.com/user/philippeback/videos
High Octane SPRL rue cour Boisacq 101 | 1301 Bierges | Belgium
Pharo Consortium Member - http://consortium.pharo.org/ Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller
On Wed, May 6, 2015 at 9:58 AM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-06 9:53 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:34 PM, phil@highoctane.be <phil@highoctane.be> wrote:
On Tue, May 5, 2015 at 6:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
At least there was a way!
Exactly :)
Looks like this is the most controlled|debuggable way: - get it working with C code out of Pharo - make a bridge that can be used easily with FFI in a dll - use that from Pharo with proven FFI
Would NativeBoost work with your dll? Should.
I have read a few resources about Nativeboost but I am still naive to know the difference between FFI and nativeboost. The FFI call I made to invoke the DLL function looked similar to the nativeboost calls.
I also tried to perform the nativeboost call by creating my structures
in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
Has this something to do with 32|64 bit library complications?
Not exactly. For me, it was more related to the fact that I had to map a complex C struct in Pharo. Here is an excerpt of the definition from MSDN:
typedef struct _IP_ADAPTER_INFO { struct _IP_ADAPTER_INFO *Next; ... PIP_ADDR_STRING CurrentIpAddress; IP_ADDR_STRING GatewayList; ... }
So, I had to define three external structures (all names in capitals) and I did the effort but in the end I got an error code that I could not debug in the image. Hence, I gave up and opted to go in the native environment. But I would like someone knowledgable to have a look at my nativeboost code because the nativeboost approach is more simple (everything's in the image).
I can have a look.
btw. for what do you need the mac address?
hardware lock.
usman
Phil
With ProcessWrapper, I could not load the classes essential for making the plugin work.
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote:
1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
Le 05/05/2015 18:28, Usman Bhatti a écrit :
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
I also tried to perform the nativeboost call by creating my structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo <https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO <https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
With ProcessWrapper, I could not load the classes essential for making the plugin work.
ProcessWrapper is loaded with GitFileTree in Pharo3 and Pharo4. Can you detail what doesn't work? Thierry
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com <mailto:btc@openinworld.com>> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com <mailto:pierce@samadhiweb.com>> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote: > 1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated: http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
On Tue, May 5, 2015 at 7:54 PM, Thierry Goubier <thierry.goubier@gmail.com> wrote:
Le 05/05/2015 18:28, Usman Bhatti a écrit :
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
I also tried to perform the nativeboost call by creating my structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo < https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO < https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
With ProcessWrapper, I could not load the classes essential for making the plugin work.
ProcessWrapper is loaded with GitFileTree in Pharo3 and Pharo4.
Can you detail what doesn't work?
When doing: Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load. Plugin classes couldn't be loaded because they require SmartSyntaxInterpreterPlugin class. I found a few posts mentioning that the class should be present in the VMMaker but I didn't dig further. regards.
Thierry
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com <mailto:btc@openinworld.com>> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com <mailto:pierce@samadhiweb.com>> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote: > 1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: ' http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
2015-05-06 9:57 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:54 PM, Thierry Goubier <thierry.goubier@gmail.com
wrote:
Le 05/05/2015 18:28, Usman Bhatti a écrit :
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
I also tried to perform the nativeboost call by creating my structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo < https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO < https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
With ProcessWrapper, I could not load the classes essential for making the plugin work.
ProcessWrapper is loaded with GitFileTree in Pharo3 and Pharo4.
Can you detail what doesn't work?
When doing:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
Plugin classes couldn't be loaded because they require SmartSyntaxInterpreterPlugin class. I found a few posts mentioning that the class should be present in the VMMaker but I didn't dig further.
Ok. Metacello new configuration: 'ProcessWrapper'; repository: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPhar40/Main'; load Is what I use. As far as I can see, ProcessWrapper-Plugin has little use; it contains only primitives which are in ProcessWrapper-Core. The plugin is automatically downloaded when you use the configuration, which means your Gofer script doesn't work. The configuration in the Meta repository is one version late compared to the Smalltalkhub repository configuration. Hernan, should I update the configuration in the Meta repository? Regards, Thierry
regards.
Thierry
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com <mailto:btc@openinworld.com>> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti <usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng <pierce@samadhiweb.com <mailto:pierce@samadhiweb.com>> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote: > 1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: ' http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
Hi Thierry, I'm in my holidays in Madrid, but let me know if you or anyone need access to the repository and it will be granted. Cheers, Hernán 2015-05-06 5:10 GMT-03:00 Thierry Goubier <thierry.goubier@gmail.com>:
2015-05-06 9:57 GMT+02:00 Usman Bhatti <usman.bhatti@gmail.com>:
On Tue, May 5, 2015 at 7:54 PM, Thierry Goubier < thierry.goubier@gmail.com> wrote:
Le 05/05/2015 18:28, Usman Bhatti a écrit :
I succeeded to do it by encapsulating the C routine as a DLL and doing an FFI call from my image (as suggested by Guille).
I also tried to perform the nativeboost call by creating my structures in Pharo. The function in Windows that can be used to retrieve mac address in Windows: GetAdaptersInfo < https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917%28v=vs.85%...> that accepts a PIP_ADAPTER_INFO < https://msdn.microsoft.com/en-us/library/windows/desktop/aa366062(v=vs.85).a...> structure. I subclassed NBExternalStructure to define this struct and the other used by it in the image but my NB call returned with 87 code (Invalid parameter) and it was impossible to debug. However, I would like to make this thing work to understand what went wrong.
With ProcessWrapper, I could not load the classes essential for making the plugin work.
ProcessWrapper is loaded with GitFileTree in Pharo3 and Pharo4.
Can you detail what doesn't work?
When doing:
Gofer it url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
Plugin classes couldn't be loaded because they require SmartSyntaxInterpreterPlugin class. I found a few posts mentioning that the class should be present in the VMMaker but I didn't dig further.
Ok.
Metacello new configuration: 'ProcessWrapper'; repository: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPhar40/Main'; load
Is what I use.
As far as I can see, ProcessWrapper-Plugin has little use; it contains only primitives which are in ProcessWrapper-Core. The plugin is automatically downloaded when you use the configuration, which means your Gofer script doesn't work.
The configuration in the Meta repository is one version late compared to the Smalltalkhub repository configuration. Hernan, should I update the configuration in the Meta repository?
Regards,
Thierry
regards.
Thierry
HTH,
Usman
On Mon, May 4, 2015 at 2:54 PM, Ben Coman <btc@openinworld.com <mailto:btc@openinworld.com>> wrote:
As a complete newb to VM building I found this fairly straight forward (on a Mac btw). https://github.com/pharo-project/pharo-vm cheers -ben
On Mon, May 4, 2015 at 5:28 PM, Usman Bhatti < usman.bhatti@gmail.com <mailto:usman.bhatti@gmail.com>> wrote:
On Sun, May 3, 2015 at 4:22 PM, Pierce Ng < pierce@samadhiweb.com <mailto:pierce@samadhiweb.com>> wrote:
On Sat, May 02, 2015 at 03:55:47PM +0200, Usman Bhatti wrote: > 1/ OSProcess: I tried (PipeableOSProcess command: 'ipconfig /all') output.
I have used http://www.smalltalkhub.com/#!/~hernan/ProcessWrapper successfully back when I was on Windows using some now-ancient version of Pharo.
I had initially discarded the idea of using this project because it required a plugin and the information of the plugin was outdated on squeaksource. However, having evaluated superficially the complexity of doing it with nativeboost (because too many external c struct involved in the call), I would like to see if I am better off using this wrapper.
I loaded it with:
Gofer it url: ' http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main'; package: 'ProcessWrapper-Core'; package: 'ProcessWrapper-Plugin'; package: 'ProcessWrapper-Tests'; load.
But the plugins wont load because it requires the class SmartSyntaxInterpreterPlugin and apparently this file is a part of the VMMaker. Is there any recent config for VMMaker in Pharo because this one looks outdated:
http://pharo.gemtalksystems.com/book/Virtual-Machine/Building/VMMakerTool/
Pierce
participants (10)
-
Ben Coman -
Esteban Lorenzano -
Henrik Johansen -
Henrik Sperre Johansen -
Hernán Morales Durand -
Nicolai Hess -
phil@highoctane.be -
Pierce Ng -
Thierry Goubier -
Usman Bhatti