Answered by:
Is there a way to program an SB extension from within the program itself?

-
It would be a plus if I didn't have to install version 0.6 to do it. Right now, I have programmed this class of the extension called Music, and so far it has this code (requires the extension found at CodePlex):
Sub stream
streamfile = MessageBox.AskForInput("Enter music file to play, local files are allowed as well.")
Sound.Play(streamfile)
EndSub
Sub holdstream
Sound.Pause(streamfile)
EndSub
Sub resumestream
Sound.Play(streamfile)
EndSub
Sub endstream
Sound.Stop(streamfile)
EndSub
Question
Answers
-
Uploaded on extension website here, in the 'Other Resource Downloads' section. I added a simple test - The only syntax change I could remember was the square brackets for arrays and I also tries a recent new command (the sound music). These work and are in a simple test case. Report any other problems and good luck.
- Proposed as answer by litdevModerator Tuesday, April 10, 2012 5:27 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee, Owner Tuesday, October 23, 2012 12:28 AM
-
It works fine for me, try the following and report.
1] Put ALL of the files in the zip in a new directory somewhere.
2] run the SmallBasicExtensionCompiler.exe and browse for the file called Compile-Test.sb - this should create a file called Compile-Test.dll in the same directory.
3] Now copy this Compile-Test.dll to the SB lib directory for extensions, open SmallBasic and run the file Compile-Run.sb
Please state exactly what step didn't work.
- Marked as answer by Ed Price - MSFTMicrosoft employee, Owner Tuesday, October 23, 2012 12:28 AM
All replies
-
Why do you have to use version 0.6?
You can write an extension in VB or C# that uses another extension, but I don't think you can write an extension directly from SmallBasic using the current version.
There have been some ideas on this in the past (e.g. here) but I don't think they are maintained and in any case it is probably easier to write an extension of the type you are writing in VB, and you get to learn VB at the same time.
EDIT
I see why you use version 0.6; this is the last version where the Fremy SmallBasicExtensionCompiler was supported. It is possible to recompile his program for use in version 1.0, but you should get his permission to do this. If you get his permission, I am happy to do the conversion.
- Edited by litdevModerator Saturday, March 03, 2012 5:41 PM
-
-
-
Why do you have to use version 0.6?
You can write an extension in VB or C# that uses another extension, but I don't think you can write an extension directly from SmallBasic using the current version.
There have been some ideas on this in the past (e.g. here) but I don't think they are maintained and in any case it is probably easier to write an extension of the type you are writing in VB, and you get to learn VB at the same time.
EDIT
I see why you use version 0.6; this is the last version where the Fremy SmallBasicExtensionCompiler was supported. It is possible to recompile his program for use in version 1.0, but you should get his permission to do this. If you get his permission, I am happy to do the conversion.
Do you happen to know his email? -
-
I contacted him, and he wrote that he never updated the compiler because he had to totally rewrite the code whenever a new SmallBasic version came out. He also said that if he can get the compiler's source code from Vijaye Raji (he now works for Facebook), he is OK to rewrite the compiler to work for this version of Small Basic. However, he doesn't want to work with a decompiled version of the compiler, as it takes too much time to start.
-
-
-
As I said in post 2:
I see why you use version 0.6; this is the last version where the Fremy SmallBasicExtensionCompiler was supported. It is possible to recompile his program for use in version 1.0, but you should get his permission to do this. If you get his permission, I am happy to do the conversion.
If you get permission from Fremy I will upload the conversion.
-
I contacted Fremy, and he said that he will allow the upload. However, he also wrote that "Not all features of Small Basic will work the same way using that compiler than using the v1.0 compiler of Small Basic (even if you should get very close, since not a lot of compiler features were added between v0.6 and v1.0)."
-
Uploaded on extension website here, in the 'Other Resource Downloads' section. I added a simple test - The only syntax change I could remember was the square brackets for arrays and I also tries a recent new command (the sound music). These work and are in a simple test case. Report any other problems and good luck.
- Proposed as answer by litdevModerator Tuesday, April 10, 2012 5:27 PM
- Marked as answer by Ed Price - MSFTMicrosoft employee, Owner Tuesday, October 23, 2012 12:28 AM
-
-
It works fine for me, try the following and report.
1] Put ALL of the files in the zip in a new directory somewhere.
2] run the SmallBasicExtensionCompiler.exe and browse for the file called Compile-Test.sb - this should create a file called Compile-Test.dll in the same directory.
3] Now copy this Compile-Test.dll to the SB lib directory for extensions, open SmallBasic and run the file Compile-Run.sb
Please state exactly what step didn't work.
- Marked as answer by Ed Price - MSFTMicrosoft employee, Owner Tuesday, October 23, 2012 12:28 AM
-
-