1

Now I can compile successfully by using make file provided, now I want to compile the project to dll file, how should I modify the make file so that I can use the dll file in windows .net framework? What I wish to have is a .net dll (not just a win32 dll).

The make file is:

default: all

# -------------------------------------------------------------------
# Change the path to Z3 4.1.1 accordingly
# The directory indicated by this path should contain "lib" and "bin"
# e.g. "/home/z3_src_4.1.1"
#      "/home/work/tool/z3/z3_src_4.1.1"
# -------------------------------------------------------------------
Z3_path = ../z3

JUNK = S3
SOURCE = strTheory.cpp testMain.cpp
INCLUDE = $(Z3_path)/lib
LIB = $(Z3_path)/bin/external

all: $(SOURCE)
    g++ -std=c++14 -O3 -fopenmp -static -I$(INCLUDE) -L$(LIB) $(SOURCE) -lz3 -lrt -o S3 -Wall
    @echo ""

clean:
    rm -f $(JUNK)
  • replace static with shared. – Devolus Oct 27 '15 at 07:37
  • `dll` (dynamic-link library) is the name used under Windows; on linux (unix?), it's called `so` (shared object) – Paolo M Oct 27 '15 at 07:37
  • There are many tutorials on how to create a *shared library* in Linux, if you just search a little. – Some programmer dude Oct 27 '15 at 07:38
  • @PaoloM becasue I want to use it in windows, how should I do –  Oct 27 '15 at 07:38
  • 1
    Okay, then the answer is that you need to *cross compile* the code, and I don't actually know if it's possible without special tools for the generation of the DLL. You might be able to do it using something like [MinGW for Linux](http://www.mingw.org/wiki/linuxcrossmingw). – Some programmer dude Oct 27 '15 at 07:40
  • @JoachimPileborg Sorry, what I want to have is a .net dll, not a win32 dll. I have modified the question to make this point clearer –  Oct 27 '15 at 07:58
  • @MikeKinghan not a duplicate, it is .net dll rather than win32 dll. –  Oct 27 '15 at 08:00
  • GCC doesn't do .NET. You might be able to cobble something together using [Mono](http://www.mono-project.com/) though. Is there a reason you don't do it natively on Windows? It will make it *much* easier. – Some programmer dude Oct 27 '15 at 08:04
  • @JoachimPileborg yes, that is what in my mind. I just wondering would it gives extra advantage (e.g., less modification of code) to compile to C++ code on Ubuntu's mono rather than Window's Visual Studio? –  Oct 27 '15 at 08:06

1 Answers1

-1

Search in the google for "cross compilers on linux". This question already asked several times

Create a library or DLL in Linux and using them on Windows

How to compile for Windows on Linux with gcc/g++?

Community
  • 1
  • 1
Nayana Adassuriya
  • 23,596
  • 30
  • 104
  • 147
  • What I wish to have is a .net dll (not just a win32 dll). Sorry, I do not give my question in a clear way, I have modified it. –  Oct 27 '15 at 07:57