Two DLLs and one app

Post Reply
kronos911
Posts: 37
Joined: Sat Oct 22, 2005 2:15 pm
Location: Greece

Two DLLs and one app

Post by kronos911 »

How can I use more than one dll in my app.
In the main prg file I add this line

Code: Select all

SET RESOURCES TO “A.DLL”, “B.DLL”
When I call something from A.DLL all is ok. When I call something from B.DLL it doesn’t show. Do I have to use SetResource(cDllName) before and after each call to B.DLL. Is there a way to make my app id both dlls automatically?
Thanks
User avatar
Chantiel
Posts: 33
Joined: Mon Oct 10, 2005 12:49 pm
Location: En una piedra en medio del Atlantico (Tenerife)

Post by Chantiel »

Greetins Kronos,

try this ...

hAdll:= LoadLibrary("A.dll")

hBdll:= LoadLibrary("B.dll")

....

[the body of your aplication]

...

// just before the end of your aplication or when u wish to liberate from
// memory the loaded libraries write this ...


FreeLibrary(oAdll)
FreeLibrary(oBdll)


// Hope it helps.



Nos leemos!!
FW 2.5 + Cl 5.3 + Blk 7.0

Sin mas ...
kronos911
Posts: 37
Joined: Sat Oct 22, 2005 2:15 pm
Location: Greece

Post by kronos911 »

Thanks for the reply. It still isn't sorking. I have two choices.
A)Merge the two dlls into one, or
B)use Setresource(cDllName) before and after calls to that dll.
DLL B is a general perpuse one that holds resources for the user login/out and movement tracking system. It's small so I guess I'll mege it into DLL A which is a program specific one.
manuramos
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Post by manuramos »

try this:LOCAL hRes1,hRes2

SET RESOURCE TO A.DLL
hRes1 := GetResources()

....
... USING A.DLL RESOURCES
...

SET RESOURCES TO B.DLL
hRes2 := GetResources()

...
... USING B.DLL RESOURCES
...

SetResouces(hRes1)
...
... USING A.DLL
...

SetResouces(hRes2)
...
... USING B.DLL
...
ETC...
Nos Gusta Programar
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Post by driessen »

I use FW 2.4, Clipper 5.3e and Blinker 7.0.

I needed 6 DLL's files to store all my screens. And that was to much to handle properly.

So what did I do ?

In Workshop 4.5, I saved all my DLL-files as RES-files.

I implimented my RES-files into my LNK-script like this :

---------------------------

OUTPUT APLLIC.EXE

BLINKER INCREMENTAL OFF
BLINKER CLIPPER SYMBOL OFF
BLINKER EXECUTABLE ALIGNMENT 128

PACKCODE
PACKDATA

FI obj1
FI obj2
....
FI objZ

DEFBEGIN
name APPLIC
description 'APPLICATION'
exetype Windows 3.1
code moveable discardable preload
data preload movable
-> rc DLL1.RES
-> rc DLL2.RES
-> rc DLL3.RES
-> rc DLL4.RES
-> rc DLL5.RES
-> rc DLL6.RES
stacksize 10500
heapsize 1024
segment 'PLANTON_TEXT' nondiscardable
segment 'EXTEND_TEXT' nondiscardable
segment 'OM_TEXT' nondiscardable
segment 'OSMEM_TEXT' nondiscardable
segment 'SORTOF_TEXT' nondiscardable
segment 'STACK_TEXT' nondiscardable
DEFEND

LIB yourlibs
LIB oFive16,oFive16C
LIB WINAPI

NO BELL

---------------------------

That is how my LNK-script looks like.

And it just works fine.

Also, you need to delete all your "SET RESOURCE TO" in your PRG-files.

the '->' in the LNK-script are just signs to put the attention on, of course.

Good luck.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Post Reply