g****y 发帖数: 101 | 1 I have a .c function (including parameter passing) files which will call
multiple other .c and .h files. There is no main function.How can I compile
them into one obj file so that it can be called by other program? Thanks a
lot! | l**t 发帖数: 64 | 2 Your problem is how to generate the static library,
and it depends on your platform.
for win32, use lib.exe (provided by vc) or ar (for win32)
for linux, use ar (provided by binutils)
compile
【在 g****y 的大作中提到】 : I have a .c function (including parameter passing) files which will call : multiple other .c and .h files. There is no main function.How can I compile : them into one obj file so that it can be called by other program? Thanks a : lot!
| g****y 发帖数: 101 | 3 Thanks!
My platform is win32. My goal is to have an obj file.
There is no main routine, only a c function. How to get an exe file?
【在 l**t 的大作中提到】 : Your problem is how to generate the static library, : and it depends on your platform. : for win32, use lib.exe (provided by vc) or ar (for win32) : for linux, use ar (provided by binutils) : : compile
| l**t 发帖数: 64 | 4 you confused me.
If you want to merge many obj files to one file, use the method I previously
told you, and a *.lib file will be generated.
If you want to get a dll file (no main entry, no exe file can be gotten),
use link.exe with the /dll option, which will generate a dll file and lib
file for you.
Of course, you can specify the c function you provided as the new entry
function, by setting the link.exe option /entry as the c function, then the
exe file will be generated and make the c function
【在 g****y 的大作中提到】 : Thanks! : My platform is win32. My goal is to have an obj file. : There is no main routine, only a c function. How to get an exe file?
| g****y 发帖数: 101 | 5 lift, Thanks for your kind help!
Here is what my professor wants:
"You sent me 19 separate *.c files, whereas HY-STONE will need only ONE
compiled shared routines to be accessed, containing all the stuff required
to operate (also all the required *.h). The routines must be compiled by
shared routines in order to obtain ONE *.obj files. These will be placed in
the same installation directory as HY-STONE.exe in order to run your
simulations."
It seems difficult to realize in the way he wants. Is i
【在 l**t 的大作中提到】 : you confused me. : If you want to merge many obj files to one file, use the method I previously : told you, and a *.lib file will be generated. : If you want to get a dll file (no main entry, no exe file can be gotten), : use link.exe with the /dll option, which will generate a dll file and lib : file for you. : Of course, you can specify the c function you provided as the new entry : function, by setting the link.exe option /entry as the c function, then the : exe file will be generated and make the c function
| l**t 发帖数: 64 | 6 Your boss maybe want to get a dynamic shared library (dll for win32).
As you said that Hy-stone.exe already existed, when it runs, it will load
the
dll file automatically, and call the predefined functions and variables in
the dll file.
Hence, you should know the specification of dll file that HY-STONE.EXE needs
, such as, what functions and variables should be exported, what the name of
dll file is. Then you should provide every functions and variables in you c
or h file.
After that, use "cl *.
【在 g****y 的大作中提到】 : lift, Thanks for your kind help! : Here is what my professor wants: : "You sent me 19 separate *.c files, whereas HY-STONE will need only ONE : compiled shared routines to be accessed, containing all the stuff required : to operate (also all the required *.h). The routines must be compiled by : shared routines in order to obtain ONE *.obj files. These will be placed in : the same installation directory as HY-STONE.exe in order to run your : simulations." : It seems difficult to realize in the way he wants. Is i
| d*h 发帖数: 2347 | 7 you compile each of the C files into an OBJ file, then use link/lib tool to
link all OBJ files into single DLL.
compile
【在 g****y 的大作中提到】 : I have a .c function (including parameter passing) files which will call : multiple other .c and .h files. There is no main function.How can I compile : them into one obj file so that it can be called by other program? Thanks a : lot!
|
|