Is there any way to compile a Windows DLL in MinGW/MSYS2 with the desired exported symbols without annotating the source code with _declspec(dllexport)?
Build DLL in MinGW/MSYS2 without declspec(dllexport)
1.6k Views Asked by BenK At
1
There are 1 best solutions below
Related Questions in DLL
- How to find a sequence of bytes on the target program from my injected dll?
- .lib not generated when building DLL project using template class
- The file "spng.dll" is not founded in my Visual Studio's project and i get an error
- Handling Memory Allocation and Pointers in Electron between Node.js and C++ DLL
- Multi level project reference using dll
- Wix MSI Project Harvesting Error Message 'dll is not running' on Build
- Windows Custom Credential Provider is not displaying tile on logon for all users in a pc
- How can I verbosely track the whole process of calling a function?
- Is dll static var shared between threads that load the same dll?
- JNR-FFI - Callback Pointer crash
- How can I patch a function call to a Windows DLL (e.g. kernel32 LoadLibrary)? Is this even possible?
- PyInstaller with PyQt5 Generates "DLL load failed" Error for QtPrintSupport
- What happens if I link two different libraries providing the same symbols in Visual Studio?
- how to test .dll on Linux
- PHP FFI - How to free memory created by FFI::new("void*[2]", false, true)
Related Questions in MINGW
- How do I print _Decimal32, _Decimal64, and _Decimal128 in C? (Also, what is a Printf hook and how do I add one?)
- How to install CMAKE on MSYS2 or MINGW64? (all servers return 404)
- How to obtain mingw-w64 version 9.3.0 or older for MSYS2?
- Dev c++ [Linker error] undefined reference to `__chkstk_ms'
- Making portable execution errors
- How to compile GLFW with GCC
- why cpp codes is not getting compiled even after i installed cpp extension?
- clang++ and mingw paths start with double slash while compiling
- Install of MINGW fails when installing from MSYS2
- Compile latest openssl with mingw64 within cygwin on Windows 11 vs install prefix path definition
- Compiling C file with MingW in Windows: The system cannot execute the specified program
- Qt Creator Application Crashing Issue
- Undefined reference in MinGW after moving from VC++
- MinGW ld linking error - undefined reference
- DLL built from static lib is flashing a console
Related Questions in MSYS2
- How to install CMAKE on MSYS2 or MINGW64? (all servers return 404)
- How to obtain mingw-w64 version 9.3.0 or older for MSYS2?
- Running clang64.exe or mingw64.exe incorrectly sets PATH
- WxWidgets configure: error: C compiler cannot create executables
- Install of MINGW fails when installing from MSYS2
- How can I move my MSYS2 folder to another folder (both in the D driver) if possible?
- Git Bash not exiting while loop, while bash in ubuntu does
- Msys2: Python 2.7 and Python 3.8 side by side, how to load correct site.py
- Troubleshooting MSYS64 Installation Issues
- Using VSCode and CMake, how do I get CMake to recognize Eigen3Config.cmake installed through MSYS2?
- why is there no mysql connector cpp package in msys2?
- Installing Dune with the help of Opam
- Different environment of MSYS2 MINGW64 shell as standalone terminal and in Visual Studio Code
- Installing GIT within MSYS2 on Windows 11
- OCaml with MSYS2 on Windows: Unbound module stdlib
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You probably already solved the problem, it has been over a year, but other people might have this problem, so:
Yes in MinGW you don't have to add the
declspec(dllexport)and a good reason might be that you just want to use someone else's library source without modifying/forking it.Here is an example
lib.cthat will be compiled into a DLL and exportingfuncwith the Makefile below:And a
lib.hfor usage in the executable:The
Makefile, but make sure that you fix the indentation: the two indented lines need a tab instead of 4 spaces:Note that the
-sharedis, what makes the output into a valid DLL and makes it exportfunc.Example
ex.cfor testing purposes: