Two DLLs and one app

Two DLLs and one app

Postby kronos911 » Thu Nov 17, 2005 1:11 pm

How can I use more than one dll in my app.
In the main prg file I add this line
Code: Select all  Expand view  RUN
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
kronos911
 
Posts: 37
Joined: Sat Oct 22, 2005 2:15 pm
Location: Greece

Postby Chantiel » Fri Nov 18, 2005 9:23 am

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 ...
User avatar
Chantiel
 
Posts: 33
Joined: Mon Oct 10, 2005 12:49 pm
Location: En una piedra en medio del Atlantico (Tenerife)

Postby kronos911 » Mon Nov 21, 2005 11:11 am

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.
kronos911
 
Posts: 37
Joined: Sat Oct 22, 2005 2:15 pm
Location: Greece

Postby manuramos » Mon Dec 26, 2005 7:50 pm

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
manuramos
 
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

Postby driessen » Tue Dec 27, 2005 10:21 am

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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 14 guests