Included file with IMPORTs

Started by Sandman, April 05, 2008, 11:18:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Sandman

Suppose we have the following files:
stuff.inc
coolness.inc
main.prg
main2.prg

Now I'm using key() in all these files and thus have to import mod_key in all of them and there's the problem. When mod_key is imported more than once, the compiler nags about multiple versions of key(), which is logical.

So my suggestion is: before the compiler actually performs the import, first check if that specific DLL (filename and filepath) was not imported before, as there is no reason anyone would want the same DLL imported twice anyway. If it was imported before, skip it (and don't look in other folders for the same DLL). And another suggestion: .imp or .import files for included files, meaning: when stuff.inc is included, the file stuff.imp (or stuff.import) is checked for libraries and those are then imported.

These two enhancement makes it possible to have much more modularity in Bennu code.
-- Sandman

SplinterGU

I'v already know it... it's a pending thing...

I don't understand this:

"And another suggestion: .imp or .import files for included files, meaning: when stuff.inc is included, the file stuff.imp (or stuff.import) is checked for libraries and those are then imported."

Explain again, please...


thanks
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Sandman

Okay so I've got:
stuff.inc
coolness.inc
main.prg
main2.prg

and I'm using a bunch of modules/DLLs in stuff.inc and coolness.inc and I want to use the .IMP system of importing them. Now, I have to make main.imp for one application and main2.imp for another. In both .imp files however, I need to specify what modules/DLLs I need for stuff.inc and coolness.inc. So if I should release some cool Bennu sourcecode for people to reuse (coolness.inc) they have to add the used modules/DLLs to their main.imp. What I'd like to see is that if coolness.inc is included, the modules specified in coolness.imp are imported, so they don't have to be thrown in one large main.imp.
I know I can import them in the code themselves, but what's the use of the .imp file then? It was so code could be compatible with Bennu and Fenix at the same time.

Actually now I think of it, I don't think I'll use the .imp files and just import them in the code. This whole system was only for code to be compatible with both Fenix and Bennu (or are there more purposes?). If you are planning on keeping this system then my suggestion remains, but I actually wouldn't miss the entire .IMP system.
-- Sandman

SplinterGU

The common modules must be locate in bgdc.imp...
You can include a module from the sourcecode in .inc or .prg too... using "import" statement like any other Bennu DLL.
The use of the .imp files was implement for the complained users that complain from change any in your code to migrate from fenix to bennu.
The .imp files are like a project file... in the future, my idea is that this files can be contain .prg and/or .h files too, like "#include" statement.
But not one .imp for .h, this is not very logical... only two(or four) .imp(and .import) files for project... 1 default (bgdc.imp and bgdc.import) and 1 for main .prg... if you do a .prg for library propose is logical that you do your import from code...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Sandman

-- Sandman