Page 1 of 1

Two DLLs and one app

Posted: Thu Nov 17, 2005 1:11 pm
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

Posted: Fri Nov 18, 2005 9:23 am
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!!

Posted: Mon Nov 21, 2005 11:11 am
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.

Posted: Mon Dec 26, 2005 7:50 pm
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...

Posted: Tue Dec 27, 2005 10:21 am
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.