Building/linking DLL using nmake 
Author Message
 Building/linking DLL using nmake

I have a c++ program developed in UNIX that I am
porting to Windows. The program consists of a
dynamically linked library and a main program
which uses the library. Since I build this on UNIX
with a Makefile, I would like to do the same under
Windows rather than importing things into the IDE.

Using the MSDN documentation, I've figured out how to
use nmake to compile the link library source files into
object files, but I can't figure out how to link those
object files into the DLL and then link the main program
to the DLL. Using GCC under UNIX, the Makefile has the
following entries for linking object files to a shared
library and compiling and linking the main program:

OBJS =  A.o     \
        B.o     \
        C.o

####### Build rules

libZ.so: $(OBJS)
        $(LINK) -shared -fPIC -o libZ.so $(OBJS)
        cp libZ.so /usr/local/lib        

program: program.cpp
        $(CC) -o program -lZ program.cpp

Can someone tell me how to build the DLL and link it to
the main program using nmake?

Thanks,

Tom



Thu, 19 Feb 2004 00:21:35 GMT  
 Building/linking DLL using nmake

Quote:
> I have a c++ program developed in UNIX that I am
> porting to Windows. The program consists of a
> dynamically linked library and a main program
> which uses the library. Since I build this on UNIX
> with a Makefile, I would like to do the same under
> Windows rather than importing things into the IDE.
> ...

> OBJS =  A.o     \
>         B.o     \
>         C.o

One obvious difference between the platforms is the choice of extension.
VC/C++ compiles C/C++ source to .obj files, not .o files.

The simplest thing to do is what you don't want to do: create a DLL project
and add the source files to it. After you do that you can select "Export
Makefile" from the "Build" menu.

Regards,
Will



Thu, 19 Feb 2004 02:59:08 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Building/linking DLL using nmake

2. Debugging project built using NMAKE

3. Replacing Borland built dll with vc built dll

4. DLL release build fails at link time

5. NMAKE doesn't work for debug build

6. Link Fails in building mixed DLL

7. L2025 Link error when building .DLL

8. use nmake build a project in my program

9. How to use nmake build a project in my program

10. link errors while building DLL

11. U1073 Build/NMake error

12. redistributing cl.exe, link.exe, nmake.exe, etc.

 

 
Powered by phpBB® Forum Software