VB omnipotent 5: Creating "standard" DLL dynamic link library files (1)
Author: bell
Blog: http://blog.csdn.net/usewayThe dynamic link library is often considered a patent of VC or dephi. DLL files can dynamically publish the functions you have compiled and can be conveniently called by other programs.
Some may ask, isn't there a project type named "ActiveX dll" in VB, And the generated file is also a "DLL" file?
Yes, the final file is indeed a DLL file, but in strict sense, the DLL created by VB is not a dynamic link library like VC, and VB is an ActiveX DLL, you cannot use the declare function like kernel32.dll ...... This article will explain in detail how to generate a DLL dynamic link library file using VB. Note that this article will detail how to generate a dynamic link library file like VC, the call method also uses "declare function ...... Well, let's create a DLL.
Principles:
When compiling a file, VB adopts two compilation methods:
The first step of compilation is to call c2.exe to generate the OBJ file.The “c2.exe file is in the "C:/program files/Microsoft Visual Studio/vb98" directory. You can find it. “C2.exe "is the command that VB calls during compilation.
Compile the second step and use link.exe to link the OBJ file.“Link.exe "is also in that folder. This file is the same as the above file and is a command line tool. With the command line tool, the command line tool can be used to define the same parameters, and the same is true for “link.exe. You can also change the parameters to adjust the results of the compiled link. The parameters are as follows: Usage: link [Options] [files] [@ commandfile] Options:/align :#
/Base: {address | @ filename, key}
/Comment: Comment
/Debug
/Debugtype: {CV | coff}
/DEF: Filename
/Defaultlib: Library
/Delay: {nobind | unload}
/Delayload: DLL
/DLL
/Driver [: {uponly | WDM}]
/Entry: Symbol
/Exetype: Dynamic
/Export: Symbol
/Fixed [: No]
/Force [: {multiple | unresolved}]
/Gpsize :#
/Heap: Reserve [, commit]
/Implib: Filename
/Include: Symbol
/Incremental: {Yes | no}
/Largeaddressaware [: No]
/Libpath: Dir
/Link50compat
/Machine: {Alpha | arm | ix86 | MIPS | mips16 | mipsr41xx | PPC | SH3 | S
/Map [: Filename]
/MapInfo: {exports | fixups | lines}
/Merge: From =
/Nodefaultlib [: Library]
/Noentry
/Nologo
/OPT: {ICF [, iterations] | noicf | Noref | nowin98 | ref | Win98}
/Order: @ filename
/Out: Filename
/PDB: {filename | none}
/Pdbtype: {CON [solidate] | Sept [ypes]}
/Profile
/Release
/Section: name, [E] [r] [W] [s] [d] [k] [l] [p] [x]
/Stack: Reserve [, commit]
/Stub: Filename
/Subsystem: {native | Windows | console | WindowsCE | POSIX }[,#[.
/Swaprun: {CD | net}
/Verbose [: Lib]
/Version: # [. #]
/VxD
/Warn [: WarningLevel]
/WindowsCE: {convert | emulation}
/WS: Aggressive is obviously a bit confused. So many parameters? Don't worry, we just need to care about a parameter -- "/export ". Adding this parameter is an option that enables the generated DLL to have the function of the output function !! Oh, you understand?
This option is not added when VB is directly linked after compilation. Therefore, functions cannot be output at the compilation menu compilation provided by VB. So what should we do ?? Do you still need to ask me ?? Of course, the VB project is compiled manually !! Well, compile it manually !! Please wait. You can see that every compilation cannot see the generated objfile. Why can you call link.exe for link ??!! Yes, we only have two choices. We need to study how to use javasc2.exe or intercept it before deleting the OBJ file. I don't think it is enough to study the use of c2.exe. Of course, if you are interested, you can study it. I don't want to study it anymore. Now I specialize in intercepting this issue. For example, if you get a screenshot, you can simply change the name of link.exeso that the system cannot find link.exe to directly obtain the OBJ file. Well, write it here today, and write the second half tomorrow. The remaining article has been written: http://blog.csdn.net/useway/archive/2010/04/15/5489951.aspx...Java programmers:
Preface,Directory
Zhuo Yue network sales Link
China-Pub sales Link
Dangdang sales LinkCommemorative post on "Java programmer, work day"
Download an electronic version of "Java programmers at work"