|
Post by Tom Mulgrew on Mar 21, 2008 22:14:57 GMT -5
I've put up Basic4GL v2.5.3.
It mainly has fixes/features for plugin DLL writers (which mainly means djlinux at the moment).
Main features are:
* Fixes the bug in standalone exes that use plugin DLLs that djlinux found a week or so ago. * Plugin DLLs can now compile and execute Basic4GL code. I thought this would be a flexible way to allow plugin DLL functions to "callback" Basic4GL code. * Plugin DLLs can also access files embedded in standalone exes.
(To use the last 2 in your own plugins, you need to download the new Plugin DLL SDK from the downloads page).
I haven't had time to put together a lot of documentation or examples, so give me a shout if anything needs more explanation.
Cheers, -Tom
|
|
|
Post by DJLinux on Mar 21, 2008 23:40:12 GMT -5
The download section isn't up to date
Joshy
|
|
|
Post by Tom Mulgrew on Mar 22, 2008 0:36:19 GMT -5
The download section isn't up to date Oops.. Forgot to upload the updated pages. Should be fixed now. -Tom
|
|
|
Post by DJLinux on Mar 22, 2008 1:03:17 GMT -5
Now i added the compiler class to my interface but i don't know how to get this interface.
i get these interface pointers IDLL_Basic4GL_Plugin and IDLL_Basic4GL_FunctionRegistry from Plugin.Load
and the interface ptr IDLL_Basic4GL_Runtime if Basic4GL call's a runtime function inside the dll
but how to hell can i get the interface pointer of IB4GLCompiler ?
Joshy
|
|
|
Post by Tom Mulgrew on Mar 22, 2008 1:15:03 GMT -5
Hi, You get it from the registry object in Load() method. There's a small example in TestDLL2 in the plugin SDK. (It has a function that compiles some code and executes it a specified number of times). Important bits are: #include "Basic4GLStandardObjects.h" ... IB4GLCompiler* compiler = NULL; ... void DLLFUNC Func_Callback(IDLL_Basic4GL_Runtime& basic4gl) { const char *text = basic4gl.GetStringParam(2); int count = basic4gl.GetIntParam(1);
// Compile text int handle = compiler->Compile(text); if (handle == 0) return; // Compiler error
// Execute it for (int i = 0; i < count; i++) { if (!compiler->Execute(handle)) return; // Execution error } } ... bool DLLFUNC Plugin::Load(IDLL_Basic4GL_FunctionRegistry ®istry, bool isStandaloneExe) { ... compiler = (IB4GLCompiler*) registry.FetchInterface("IB4GLCompiler", IB4GLCOMPILER_MAJOR, IB4GLCOMPILER_MINOR); if (compiler == NULL) { pluginError = "Cannot find compiler object."; return false; } ...
Hope this helps, -Tom
|
|
|
Post by DJLinux on Mar 22, 2008 1:29:38 GMT -5
thanx FetchInterface is the key  Joshy
|
|
|
Post by DJLinux on Mar 22, 2008 4:07:06 GMT -5
Hello Tom good job realy it's perfect for callbacks.
Joshy
|
|
|
Post by Nicky Peter Hollyoake on Mar 22, 2008 21:50:14 GMT -5
Whenever I try and build a .DLL errors come up.
Compiling: C:\Program Files\Basic4GL\PluginDLLMain.cpp C:\Program Files\Basic4GL\PluginDLLMain.cpp:16:34: Basic4GLDLLInterface.h: No such file or directory C:\Program Files\Basic4GL\PluginDLLMain.cpp:37: error: expected class-name before '{' token C:\Program Files\Basic4GL\PluginDLLMain.cpp:40: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:41: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:42: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:43: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:44: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:45: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:46: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:47: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:48: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:56: error: expected constructor, destructor, or type conversion before "int" C:\Program Files\Basic4GL\PluginDLLMain.cpp:68: error: `DLLExport' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:80: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:97: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:109: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:130: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:139: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:147: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:154: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:161: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:167: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:174: error: `DLLFUNC' does not name a type C:\Program Files\Basic4GL\PluginDLLMain.cpp:180: error: `DLLFUNC' does not name a type Process terminated with status 1 (0 minutes, 1 seconds) 24 errors, 0 warnings
I thought it might of been the code I made, but then I tryed it without my code (I tryed one of the examples). But I still get errors, am I doing something wrong?
Another thing is how do you return an array to?
basic4gl.SetFloatArrayResult?
[glow=red,2,300]Nicky[/glow]
|
|
|
Post by Tom Mulgrew on Mar 23, 2008 0:50:41 GMT -5
Whenever I try and build a .DLL errors come up. What compiler/IDE are you using? Codeblocks? Look inside the "include" directory, and make sure Basic4GLDLLInterface.h is there. If it is, it's likely that the compiler does not know to look in there. You need to make sure that directory is part of the project's "include" path. (In Codeblocks it's Project->Build options then click the "Directories" and "Compiler" tabs.) This tells the C++ compiler where to look for files when it sees an "#include" line. It seems like the compiler cannot find this file (which is why the "no such file or directory" error comes up). Because it doesn't find the file, it doesn't compile the code that tells it what DLLFUNC means (which is why the other errors come up next). Like this: // Allocate array float array[10];
// Put some numbers in it for (int i = 0; i < 10; i++) array[i] = i;
// Return it to Basic4GL program basic4gl.SetFloatArrayResult(array, 1, 10); The "1" means that it's a 1D array. The 10 means that it has 10 elements.
|
|
|
Post by Nicky Peter Hollyoake on Mar 23, 2008 1:13:10 GMT -5
Thank you I figured it out myself though. Glad to know someone was willing to help though.  My first .DLL. Get it here. Got ... Add(INT, INT) Times(Float, Float) Vec5(var1, var2, var3, var4, var5) I would of made add and times to handle both int and float, but this is just a test I only just got into making these.  Vec5 ain't working proper, I think I must be doing something wrong with returning arrays, can someone show me an exemple of returning arrays? And how it would be registered? [glow=red,2,300]Nicky[/glow]
|
|
|
Post by Nicky Peter Hollyoake on Mar 23, 2008 8:07:31 GMT -5
Mhm I figured it out.
EDIT:
How would you use the locate?
|
|
|
Post by Darkjester on Apr 16, 2008 22:54:42 GMT -5
Tom i would like to build some plugins but im having problems uderstanding the sdk and getttin your examples to compile im using codeblocks with mingw compiler gcc
|
|
|
Post by smc44 on Jun 24, 2008 9:02:39 GMT -5
could you make basic4GL able to use C++ compilers and SDL and SDK from microsoft direct3d and openGL?
|
|