Author Topic: ? about compiling C code produced with ScriptBasic  (Read 37638 times)

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: ? about compiling C code produced with ScriptBasic
« Reply #15 on: October 13, 2014, 02:24:11 PM »
You can find the Windows gcc (TDM) version that Armando (AIR) did in the downloads section of the forum.

GSAC3

  • Guest
Re: ? about compiling C code produced with ScriptBasic
« Reply #16 on: October 16, 2014, 02:11:58 PM »
John:

After searching through nearly all of the forum messages in the DOWNLOAD section, I am unable to find an example of how to produce a "small footprint", standalone EXE using GCC.  The example you provided in your SB2C message thread is for LINIX, not WINDOWS XT.  I have been trying, unsuccessfully, for several days now to produce a WINDOWS version of what you did under LINIX.

If you have your WINDOWS XP box working now, can you provide a clear example for WINDOWS like you did for LINIX?

Don


Don

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: ? about compiling C code produced with ScriptBasic
« Reply #17 on: October 16, 2014, 05:35:25 PM »
This worked for me. I recompiled the current Script BASIC 2.2 source with TDM-GCC-32 and attached a zip with binaries needed to compile to C.  Let me know if you run into any problems.


C:\sb22\test>type 4next.sb
FOR x = 1 to 5
  PRINT x,"\n"
NEXT x

C:\sb22\test>scriba -Co 4next.c 4next.sb
C:\sb22\test>gcc -Os 4next.c -I \sb22\source C:\TDM-GCC-32\lib\sb.a -lscriba -lm -lpthread -lws2_32 -ladvapi32 -o 4next
C:\sb22\test>4next
1
2
3
4
5

C:\sb22\test>dir 4next.*
 Volume in drive C has no label.
 Volume Serial Number is 1415-F200

 Directory of C:\sb22\test

10/16/2014  05:32 PM             2,619 4next.c
10/16/2014  05:32 PM            42,505 4next.exe
10/16/2014  05:25 PM                40 4next.sb
               3 File(s)         45,164 bytes
               0 Dir(s)  67,840,901,120 bytes free

C:\sb22\test>
« Last Edit: October 16, 2014, 09:51:04 PM by support »

GSAC3

  • Guest
Re: ? about compiling C code produced with ScriptBasic
« Reply #18 on: October 17, 2014, 02:47:49 PM »
John:

Thanks for the sample GCC compile setup.

I am having a little trouble with the GCC compile, however.  I put the new BIN and LIB subdirectories in my SB22b2 installation, and when I try my TEST sample using the command line sequence below --

scriba -Co TEST.c TEST.sb

gcc -Os TEST.c -I G:\sb22\source G:\MinGW32\lib\sb.a -lscriba -lm -lpthread
-lws2_32 -ladvapi32 -o TEST

The GCC compile above returns two error messages:

“can’t find –lscriba"  and “can’t find –lpthread”

I know I must be doing something wrong but I don't know what.
Where are or should lscriba and lpthread be located?
I am using MinGW32 version 4.9.1.

Don

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: ? about compiling C code produced with ScriptBasic
« Reply #19 on: October 17, 2014, 05:57:54 PM »
libscriba.a and sb.a go in  your MinGW32 lib directory.

If your Script BASIC bin directory is in your search path, you can put your libscriba.dll in there. You need to point to the Script BASIC source headers with the -I command line argument. Look in the MinGW32 lib directory for a libpthread????.a and adjust your command line with the proper filename.

Make sure you're using the MinGW32 shell or have run the .bat script in a standard shell to setup the environment.
« Last Edit: October 17, 2014, 06:03:14 PM by support »

GSAC3

  • Guest
Re: ? about compiling C code produced with ScriptBasic
« Reply #20 on: October 19, 2014, 02:09:54 PM »
John:

Thanks again for your help.  I have everything located in the correct directories now and everything works fine!

One strange thing I discovered was that the MinGW32 distribution I had installed was missing a copy of the libpthread.a file.  I located a copy of the missing file in another MinGW32 distribution that I had loaded with GFORTRAN so I used it and all seems to be working well.

Thanks again for your help.

Don

Support

  • Administrator
  • *****
  • Posts: 22
    • View Profile
Re: ? about compiling C code produced with ScriptBasic
« Reply #21 on: October 19, 2014, 02:20:41 PM »
Good to hear Don!

Please keep us in the loop with your Script BASIC adventures.