#### Archived

This topic is now archived and is closed to further replies.

# dlls to store used functions

This topic is 5843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i am using a dll file in my game (with Win32 Dynamic Lybrary Workspace) and when it compiles isn''t it supposed to create a .lib file so that i can link the lib file and dll to other projects? also, how exactly do i link the dll to the other projects so that when i compile a workspace that requires sourcefiles from a dll i don''t get error?

##### Share on other sites
Producing the .lib file:

There''s a checkbox "Doesn''t produce .LIB". Make sure that''s not checked.

To set up dependencies, go to Project->Dependencies and set up the projects in your workspace.

*WARNING* Visual Studio isn''t perfect about this. If you''re using incremental build, it will sometimes not compile a dependency and it can cause some strange errors. To fix it, just go to Build->Rebuild All. That will force all dependencies and your current project to build.

##### Share on other sites
i was looking at the half life dll files and when they compile it says:

Creating library .\Debug/client.lib and object .\Debug/client.exp
Copying to \half-life\mp\cl_dlls
1 file(s) copied

my file does not say creating library... and i don''t have doesn''t create lib set... what could be my problem?

##### Share on other sites
i get other problems to:

Deleting intermediate files and output files for project ''mf - Win32 Debug''.
Deleting intermediate files and output files for project ''DarkOre - Win32 Debug''.
--------------------Configuration: mf - Win32 Debug--------------------
Compiling...
MapFile.cpp
--------------------Configuration: DarkOre - Win32 Debug--------------------
Compiling...
data.cpp
glfxnz.cpp
main.cpp
MapFile.cpp
OreImage.cpp
render.cpp
LINK : fatal error LNK1104: cannot open file "\Steve\Dark Ore\mf\Debug\mf.lib"

DarkOre.exe - 1 error(s), 0 warning(s)

##### Share on other sites
Hmm, I''d have to see the project / workspace files, but you may not have the projects setup correctly. Is the mf project a ''Win32 Dynamic Link Library'' project?

And are you sure that the .lib file doesn''t get produced? It would be in mf/debug/mf.lib. It may be created and the DarkOre project might just be referencing the lib file by a bad absolute / relative path.

##### Share on other sites
yes the project is a win32 dynamic link library and ive checked and mf.lib is not created... and its not only this project... ive also tried to make similar dll files and none of them have created .lib

##### Share on other sites
Are you including mf.lib in your additional libraries path? If you are, you do not need to include the built libs in the projects library path, they are automatically included. Also, that message may appear if
2. The path to create the lib is invalid.

Check out these settings.

-----------------------------
kevin@mayday-anime.com
http://games.mayday-anime.com

##### Share on other sites
I dont think any of those things are my problem:

http://www.mnuniverse.com/files/Image2.jpg

Edited by - J_T_Biggs on December 10, 2001 5:38:16 PM

##### Share on other sites
I''ve had this problem before. Are you exporting any functions? Example, do you have something that looks like this:
  VOID SomeFunction();

or something that looks like this?
  VOID __declspec(dllexport) SomeFunction();

if it''s the first one, you arent exporting any symbols, and MSVC wont produce a .lib, as it assumes that you dont want one. What you have to do is add the __declspec(dllexport) to all of your functions, like I have it up there, and then in another header that you can include in another project, have the same prototypes as above, except using __declspec(dllimport), to tell the compiler that you are importing that function, and to link with the lib.

Z.

##### Share on other sites
I just saw that you set the output to mf.dll I guess that has to be an error you are trying to do a lib. Do not specify an output name ever except if you need something special.

If you go to your debug directory, you''ll prob find a mf.dll simply rename that to mf.lib and you are going.

You could also try to dumpbin the file to see what it exports in order to make sure that you set up the exports right.

Hope this helps

-- Sturm

P.S.
And remember never specify a name in the debug, if it''s not needed. If in doubt simply DONT DO IT.

---------------------------------------------------
Life after death? No thanks, I want to live NOW
--- Sturm 2001

##### Share on other sites
A method left over from W16 is to use a .EXP file. It looks like this:

LIBRARY mylib
EXPORTS
Function1 @1
Function2 @2
SomeotherFunction @3

.
.
.

You get the idea.
It''s a way of forcing the build to create a .lib file. Not perfect, but I could never get decspl(_dllexport) to work anyway.

Superpig
- saving pigs from untimely fates
- sleeps in a ham-mock at www.thebinaryrefinery.cjb.net

##### Share on other sites
"If you go to your debug directory, you'll prob find a mf.dll simply rename that to mf.lib and you are going."

I doubt that would work.

"And remember never specify a name in the debug, if it's not needed. If in doubt simply DONT DO IT."

That's not correct, when you create a project in VC6 it automatically puts the output filename there. He's not trying to build a static library, he's trying to build a dynamic link library and he wants the project to output the library which is part of the normal DLL build process.

Edited by - jonstelly on December 11, 2001 8:31:11 PM

##### Share on other sites
UPS Totally misread this one, I thought you were creating a Library not an DLL. Okay In this case you are right there has to be a .LIB file in your output directory. Is there a DLL?

About the naming sorry, it just shows how quickly you (In this case me) forget old stuff. I''m not using VC6 but VC.NET and have been for almost a year now, and here they split things up so I''ve mixed things a little bit up sorry.

So bottom line, did you generate a DLL? and do you export things from it (use dumpbin)? These are the two most inportant things to find out first

-- Sturm

---------------------------------------------------
Life after death? No thanks, I want to live NOW
--- Sturm 2001

##### Share on other sites
If you create a win32 DLL, and use the third wizard option (create a dll that exports some symbols), you will fiigure it out. It uses a macro that defines __declspec(dllexport) or __declspec(dllimport), depending on a preprocessor define, that is defined when you compile the DLL, and not when you use those functions in another project.

Using a .def or .exp (same thing) wil also do it, but it gets to be a bit of a pain to keep updating it when you add a new function.

Z.

• ### Forum Statistics

• Total Topics
628633
• Total Posts
2983956

• 10
• 18
• 20
• 13
• 9