Re: Want to run C code in Pharo using UFFI

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

Re: Want to run C code in Pharo using UFFI

Torsten Bergmann
From the filename I guess it is Windows. Should work with:

  LibC system: 'D:/DEV_FreeCAD/build/bin/box.step'

but note that .step is not a regular executable extension like EXE and other.
More a file type that is associated with the executable of free cad.

You can also check the Process class in https://github.com/astares/Pharo-OS-Windows
if you need more control.

For detailed questions you can meet me on Pharo Discord.

Bye
T. (aka astares)


> Gesendet: Donnerstag, 18. Juni 2020 um 08:18 Uhr
> Von: "shawon58" <[hidden email]>
> An: [hidden email]
> Betreff: [Pharo-dev] Want to run C code in Pharo using UFFI
>
> Hello There
> i am new to Pharo, so as i learn UFFI can handle c code, but i want to know
> that, how to run below attached code using UFFI.
>
> #include<stdlib.h>
> #include<stdio.h>
>
> int main( void ) {
>
>   int result ;
>   result=system("D:/DEV_FreeCAD/build/bin/box.step");
>   printf("%d",result);
>   return 0;
> }
>
>
> So if anyone have idea please share with me. It will be a great help to me.
>
> Thanks for your kind help
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Want to run C code in Pharo using UFFI

shawon58
Hello
Do you have any idea about compiling a C/C++ file using LibC in pharo ? if  i can compile a C++ file using Pharo than i can run that .exe file using pharo LibC

Thanks


On Thu, Jun 18, 2020 at 3:13 PM Torsten Bergmann <[hidden email]> wrote:
From the filename I guess it is Windows. Should work with:

  LibC system: 'D:/DEV_FreeCAD/build/bin/box.step'

but note that .step is not a regular executable extension like EXE and other.
More a file type that is associated with the executable of free cad.

You can also check the Process class in https://github.com/astares/Pharo-OS-Windows
if you need more control.

For detailed questions you can meet me on Pharo Discord.

Bye
T. (aka astares)


> Gesendet: Donnerstag, 18. Juni 2020 um 08:18 Uhr
> Von: "shawon58" <[hidden email]>
> An: [hidden email]
> Betreff: [Pharo-dev] Want to run C code in Pharo using UFFI
>
> Hello There
> i am new to Pharo, so as i learn UFFI can handle c code, but i want to know
> that, how to run below attached code using UFFI.
>
> #include<stdlib.h>
> #include<stdio.h>
>
> int main( void ) {
>
>   int result ;
>   result=system("D:/DEV_FreeCAD/build/bin/box.step");
>   printf("%d",result);
>   return 0;
> }
>
>
> So if anyone have idea please share with me. It will be a great help to me.
>
> Thanks for your kind help
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Want to run C code in Pharo using UFFI

hogoww

Using Astares's answer you can do:

 LibC system: 'my command line for compilation'

Pierre
On 18/06/2020 09:21, Shawon Hoque wrote:
Hello
Do you have any idea about compiling a C/C++ file using LibC in pharo ? if  i can compile a C++ file using Pharo than i can run that .exe file using pharo LibC

Thanks


On Thu, Jun 18, 2020 at 3:13 PM Torsten Bergmann <[hidden email]> wrote:
From the filename I guess it is Windows. Should work with:

  LibC system: 'D:/DEV_FreeCAD/build/bin/box.step'

but note that .step is not a regular executable extension like EXE and other.
More a file type that is associated with the executable of free cad.

You can also check the Process class in https://github.com/astares/Pharo-OS-Windows
if you need more control.

For detailed questions you can meet me on Pharo Discord.

Bye
T. (aka astares)


> Gesendet: Donnerstag, 18. Juni 2020 um 08:18 Uhr
> Von: "shawon58" <[hidden email]>
> An: [hidden email]
> Betreff: [Pharo-dev] Want to run C code in Pharo using UFFI
>
> Hello There
> i am new to Pharo, so as i learn UFFI can handle c code, but i want to know
> that, how to run below attached code using UFFI.
>
> #include<stdlib.h>
> #include<stdio.h>
>
> int main( void ) {
>
>   int result ;
>   result=system("D:/DEV_FreeCAD/build/bin/box.step");
>   printf("%d",result);
>   return 0;
> }
>
>
> So if anyone have idea please share with me. It will be a great help to me.
>
> Thanks for your kind help
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Want to run C code in Pharo using UFFI

shawon58
Hello
Do you have any idea about compiling a C/C++ file using LibC in pharo ? if  i can compile a C++ file using Pharo than i can run that .exe file using pharo LibC

Thanks

On Thu, Jun 18, 2020 at 3:25 PM hogoww <[hidden email]> wrote:

Using Astares's answer you can do:

 LibC system: 'my command line for compilation'

Pierre
On 18/06/2020 09:21, Shawon Hoque wrote:
Hello
Do you have any idea about compiling a C/C++ file using LibC in pharo ? if  i can compile a C++ file using Pharo than i can run that .exe file using pharo LibC

Thanks


On Thu, Jun 18, 2020 at 3:13 PM Torsten Bergmann <[hidden email]> wrote:
From the filename I guess it is Windows. Should work with:

  LibC system: 'D:/DEV_FreeCAD/build/bin/box.step'

but note that .step is not a regular executable extension like EXE and other.
More a file type that is associated with the executable of free cad.

You can also check the Process class in https://github.com/astares/Pharo-OS-Windows
if you need more control.

For detailed questions you can meet me on Pharo Discord.

Bye
T. (aka astares)


> Gesendet: Donnerstag, 18. Juni 2020 um 08:18 Uhr
> Von: "shawon58" <[hidden email]>
> An: [hidden email]
> Betreff: [Pharo-dev] Want to run C code in Pharo using UFFI
>
> Hello There
> i am new to Pharo, so as i learn UFFI can handle c code, but i want to know
> that, how to run below attached code using UFFI.
>
> #include<stdlib.h>
> #include<stdio.h>
>
> int main( void ) {
>
>   int result ;
>   result=system("D:/DEV_FreeCAD/build/bin/box.step");
>   printf("%d",result);
>   return 0;
> }
>
>
> So if anyone have idea please share with me. It will be a great help to me.
>
> Thanks for your kind help
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Want to run C code in Pharo using UFFI

Esteban Lorenzano
Hi,

You need to have gcc or clang installed, pharo will not do the compile job for you.
Then you can execute something like 

LibC system: ‘g++ -o myprogram myprogram.cpp’

Esteban

On 18 Jun 2020, at 09:42, Shawon Hoque <[hidden email]> wrote:

Hello
Do you have any idea about compiling a C/C++ file using LibC in pharo ? if  i can compile a C++ file using Pharo than i can run that .exe file using pharo LibC

Thanks

On Thu, Jun 18, 2020 at 3:25 PM hogoww <[hidden email]> wrote:

Using Astares's answer you can do:

 LibC system: 'my command line for compilation'

Pierre
On 18/06/2020 09:21, Shawon Hoque wrote:
Hello
Do you have any idea about compiling a C/C++ file using LibC in pharo ? if  i can compile a C++ file using Pharo than i can run that .exe file using pharo LibC

Thanks


On Thu, Jun 18, 2020 at 3:13 PM Torsten Bergmann <[hidden email]> wrote:
From the filename I guess it is Windows. Should work with:

  LibC system: 'D:/DEV_FreeCAD/build/bin/box.step'

but note that .step is not a regular executable extension like EXE and other.
More a file type that is associated with the executable of free cad.

You can also check the Process class in https://github.com/astares/Pharo-OS-Windows
if you need more control.

For detailed questions you can meet me on Pharo Discord.

Bye
T. (aka astares)


> Gesendet: Donnerstag, 18. Juni 2020 um 08:18 Uhr
> Von: "shawon58" <[hidden email]>
> An: [hidden email]
> Betreff: [Pharo-dev] Want to run C code in Pharo using UFFI
>
> Hello There
> i am new to Pharo, so as i learn UFFI can handle c code, but i want to know
> that, how to run below attached code using UFFI.
>
> #include<stdlib.h>
> #include<stdio.h>
>
> int main( void ) {
>
>   int result ;
>   result=system("D:/DEV_FreeCAD/build/bin/box.step");
>   printf("%d",result);
>   return 0;
> }
>
>
> So if anyone have idea please share with me. It will be a great help to me.
>
> Thanks for your kind help
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Want to run C code in Pharo using UFFI

shawon58
Hello Esteban Lorenzano
i can now compile using "LibC system: ‘g++ -o myprogram myprogram.cpp’ " . So can u give me idea how to set the path for compiling  myprogram.cpp .
Because in my case my test.cpp file is in the 'D:/DEV_FreeCAD/build/bin/ ' folder. I want to compile the file from that directory.

Thanks for your Kind help
Shawon Hoque

On Thu, Jun 18, 2020 at 4:01 PM Esteban Lorenzano <[hidden email]> wrote:
Hi,

You need to have gcc or clang installed, pharo will not do the compile job for you.
Then you can execute something like 

LibC system: ‘g++ -o myprogram myprogram.cpp’

Esteban

On 18 Jun 2020, at 09:42, Shawon Hoque <[hidden email]> wrote:

Hello
Do you have any idea about compiling a C/C++ file using LibC in pharo ? if  i can compile a C++ file using Pharo than i can run that .exe file using pharo LibC

Thanks

On Thu, Jun 18, 2020 at 3:25 PM hogoww <[hidden email]> wrote:

Using Astares's answer you can do:

 LibC system: 'my command line for compilation'

Pierre
On 18/06/2020 09:21, Shawon Hoque wrote:
Hello
Do you have any idea about compiling a C/C++ file using LibC in pharo ? if  i can compile a C++ file using Pharo than i can run that .exe file using pharo LibC

Thanks


On Thu, Jun 18, 2020 at 3:13 PM Torsten Bergmann <[hidden email]> wrote:
From the filename I guess it is Windows. Should work with:

  LibC system: 'D:/DEV_FreeCAD/build/bin/box.step'

but note that .step is not a regular executable extension like EXE and other.
More a file type that is associated with the executable of free cad.

You can also check the Process class in https://github.com/astares/Pharo-OS-Windows
if you need more control.

For detailed questions you can meet me on Pharo Discord.

Bye
T. (aka astares)


> Gesendet: Donnerstag, 18. Juni 2020 um 08:18 Uhr
> Von: "shawon58" <[hidden email]>
> An: [hidden email]
> Betreff: [Pharo-dev] Want to run C code in Pharo using UFFI
>
> Hello There
> i am new to Pharo, so as i learn UFFI can handle c code, but i want to know
> that, how to run below attached code using UFFI.
>
> #include<stdlib.h>
> #include<stdio.h>
>
> int main( void ) {
>
>   int result ;
>   result=system("D:/DEV_FreeCAD/build/bin/box.step");
>   printf("%d",result);
>   return 0;
> }
>
>
> So if anyone have idea please share with me. It will be a great help to me.
>
> Thanks for your kind help
>
>
>
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>
>