Register to post in forums, or Log in to your existing account
 

This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion
theNerd
Adept


Joined: 01 Mar 2005
Posts: 277

PostPosted: Thu Apr 21, 2005 6:14 pm   

DLL Access and Compiled Code
 
I decided to make this a new topic so as not to dilute any others. And remember, this is only for discussion and is understandedly not a priority.

We briefly talked about accessing normal DLL's from within zApp. If zApp could do this directly that would be great. However, I came accross a freeware language called ExtremeBasic. It is a BASIC that can have inline C++ (and therefore, also Assembly.) The BASIC code was interpretted byte code and the C++ was compiled using a freeware C++ compiler. That is a good way to speed up certain parts of the application without resorting to an external DLL. How difficult would it be to add this ability to zApp if it actually used a Pascal language (like here: http://www.freepascal.org/) ?

For example, I could do the following:

Code:
<compiled>
... my Pascal code
</compiled>


It would be compiled and significanlty faster and would be able to access normal DLL's directly, also (I am assuming but I am not familiar with the Free Pascal too much.)

Edited to Add: Check out this page that talks about the advantages of FreePascal: http://www.freepascal.org/advantage.html


Last edited by theNerd on Thu Apr 21, 2005 6:51 pm; edited 1 time in total
Reply with quote
theNerd
Adept


Joined: 01 Mar 2005
Posts: 277

PostPosted: Thu Apr 21, 2005 6:18 pm   
 
Don't be afraid to slap me upside the head if I sound ridiculous! Embarassed
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Apr 21, 2005 9:57 pm   
 
I almost think this would be better done as an <ASSEMBLY> tag possibly with some sort of mime/uuencode done to make it a viewable block in normal editors. This would allow future developers the abilty to provide thier own compiler and linker mechanisms. The tag would have to have the abilty to place variables on the stack in order for them to be accessible to the compiled code. Overall I think it likely that it would cause many problems working out just the creation of such a tag. Most of those problems would be in figuring out and documenting one method of preforming such an integration, perhaps with the free pascal that theNerd mentioned. Time wise maybe something for a version after eMobius and the second version of zApp IDE as portions of the compiling and linking would likely be best handled through IDE meta tags.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Apr 21, 2005 11:12 pm   
 
My feeling on this is that any of this kind of stuff (low level DLL API access, assembly code, etc) defeats the entire purpose of zApp and doesn't belong in zApp at all. This is exactly the kind of stuff you are supposed to put within a DLL file and create a COM object that can then be called with zApp.

See, COM objects have memory management. Scripting languages, like VBScript, don't have memory management, so it relies on the memory management of COM objects themselves.

Think of this specific example: consider a DLL call that takes a pointer to some memory structure. In C you'd normally allocate this memory, then pass the pointer to the DLL, then free the memory. This is the low-level memory management that is what makes traditional programming "hard" and leads to leaks and bugs when programmers forget to free memory, or you try to access a null pointer.

A scripting language, like VBScript, has no way to allocate and deallocate memory like this. And COM doesn't allow you to pass pointers for this very reason. You are supposed to hide this kind of low-level code in your own COM object and then call the COM object from the scripting language.

Yes, this requires you to have a "real" compiler that can create COM objects, such as Delphi or Visual Studio. zApp is never going to replace those kind of tools when performance and low-level memory management is needed.

That's my current philosophy on this. The more I have thought about it, the more it looks like a bad idea for zApp to get into that kind of stuff. I'm trying to get people *away* from the low-level traditional programming thinking.

Writing a program in zApp is supposed to be analogous to writing a web page application (like in PHP). When scripting a web page, you *never* access the API or DLLs directly. You don't allocate your own memory. This would cause havoc on web servers. The web page is a higher-level view of a task to be performed where you rely on the routines and objects of your scripting language to handle the low level details. For example, in PHP you don't access the MySQL DLL directly...you call PHP routines that handle it for you.
Reply with quote
theNerd
Adept


Joined: 01 Mar 2005
Posts: 277

PostPosted: Thu Apr 21, 2005 11:19 pm   
 
I agree with you trying to keep the zApp philosophy intact. Once you implement something like this you open a whole new can of worms. Creating an ActiveX DLL is easy enough, anyways.
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 867
Location: USA

PostPosted: Fri Apr 22, 2005 5:30 am   
 
theNerd wrote:
I agree with you trying to keep the zApp philosophy intact. Once you implement something like this you open a whole new can of worms. Creating an ActiveX DLL is easy enough, anyways.


I agree.

If there's some chunk of code that should be compiled, then I'd rather use my normal IDE to write and check it and make a DLL, not try to figure out the horrendous namespace and data visibility+accessibility issues that would come along with this.

-Tarn
Reply with quote
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2009 Zugg Software. Hosted on Wolfpaw.net