BASIC Developer & Support Resources > Interpreters

dynamically calling DLLs

(1/8) > >>

Steve A.:
Okay guys,
I have spent days trying to figure this one out.
I have been reworking Bxbasic and adding new features that might take it beyond the scope of a toy.
One big hurdle I've been trying to overcome is interpreter "bloat".
You can't just keep adding new features and still keep the runtime engine relatively compact.
That's one major down-side of interpreters, they just keep getting bigger.

I have been experimenting with the idea of dynamically calling functions in DLLs.
I have a simplified version in place, but, it only works with simple data types: int and char, as parameters.

This is not a new idea, it's been done before.
There are commercial products out there that do this.
I'll use LibertyBasic as an example, with: CALLDLL.

Initially, you might think: "okay, just create templates to handle the data types and go from there".
Not that easy. There are an undetermined number of parameters in various combinations of arrangement.

Has anyone here worked on this subject before and come up with a solution?
Your help will be greatly appreciated and I'm sure, useful to others.

JRS:
Steve,

You might want to have a peek at ScriptBasic and see how it does it. If you want a standalone executable, you have two options. Translate the user PCode into a C wrapper and link it with libscriba.dll for 12KB of interface between the two. The other option is to piggyback the interpreter to the user program. (450KB of run time overhead) Every time scriba starts, it checks to see if there is a user script attached.

ScriptBasic Windows uses an extension module (DYC) to generically call DLLs from the Basic. Traditionally you would create a shared object interface that tightly integrates with the ScriptBasic API for external library interfacing. SB has a simple DECLARE statement to bind it's extension modules with the scripts.

John

rdc:
Google LoadLibrary and GetProcAddress.

Example:

http://www.daniweb.com/forums/thread109249.html

Steve A.:
Hey John,

--- Quote from: JRS on October 07, 2010, 10:22:27 am ---You might want to have a peek at ScriptBasic and see how it does it. If you want a standalone executable, you have two options.

--- End quote ---

Nope, Bxbasic can do standalone Exe's.
Not the problem.


--- Quote ---ScriptBasic Windows uses an extension module (DYC) to generically call DLLs from the Basic. Traditionally you would create a shared object interface that tightly integrates with the ScriptBasic API for external library interfacing. SB has a simple DECLARE statement to bind it's extension modules with the scripts.
--- End quote ---

I did look at the online ScriptBasic Docs and saw no mention of "dynamically calling DLL's".
I think I even searched the forum for that topic and found nothing.
I must be wrong.

Okay, what you are saying is, SB can take a previously undefined DLL and Function there-in and execute it, passing random parameters?
And, the source code for doing that is available ?

Edit:
I should add, that I did download SB and began combing thru the source files.
I did not find the algorithm I was looking for there.

Any suggestion on what file I might be looking for ?
Thanks

Steve A.:
Hey Aurel,


--- Quote from: Aurel on October 07, 2010, 10:51:14 am ---What about using static library as option which can be compiled with
interpreter exe and there is no need for external dll-s.
I think (but maby im wrong....) that on this way is execution much faster then with calling dll-s.

--- End quote ---

Yes, but that's what I'm trying to get away from.
I don't want to add 1000 DLL functions to Bxbasic.

Navigation

[0] Message Index

[#] Next page

Go to full version