Skip to contentSkip to conversation

MinGW to build DLL not EXE

Openvpn-devel Simon Rozman 3 participants 5 messages Oct 10, 2018

lore
Share & tools
lore
#0 lore raw

Hi!

I have almost finished integrating tapctl.exe and openvpnmsica.dll utilities for MSI packaging into the OpenVPN/openvpn repo. However, I am totally new with MinGW and would need some help.

How do you tell the OpenVPN's build process to create a DLL file, not an EXE?

My working copy is here:
https://github.com/rozmansi/openvpn/tree/feature/msi

Best regards,
Simon

#1 lore raw
Quoted 6 lines · Simon Rozman

I have almost finished integrating tapctl.exe and openvpnmsica.dll utilities for MSI packaging into the OpenVPN/openvpn repo. However, I am totally new with MinGW and would need some help.

How do you tell the OpenVPN's build process to create a DLL file, not an EXE?

Usually 'gcc -o file.dll -shared ...'.
What .dll are taking about, a plugin?

Signature · 1 line
--gv
#2 lore raw

Hi,

Quoted 2 lines

Usually 'gcc -o file.dll -shared ...'.
What .dll are taking about, a plugin?

Not an OpenVPN plugin actually. A separate standalone DLL file used in a later MSI packaging. Windows-only. I had a discussion with Samuli it would be best in a long term to have it in the OpenVPN/openvpn repo for consistent production-flow.

Regards,
Simon

#3 lore raw
In reply to Simon Rozman

HI,

Quoted 9 lines

I have almost finished integrating tapctl.exe and openvpnmsica.dll utilities
for MSI packaging into the OpenVPN/openvpn repo. However, I am totally new with MinGW and would need some help.

How do you tell the OpenVPN's build process to create a DLL file, not an EXE?

As with gcc mingw takes -shared option to create dll. But I guess you want to use autotools. If so:

In configure.ac add "LT_INIT([win32-dll])" and a barebones Makefile.am would be

lib_LTLIBRARIES = libtest.la
libtest_la_LDFLAGS = -no-undefined -avoid-version
libtest_la_SOURCES = test.c
libtest_la_CFLAGS = --std=c99

Run autoreconf -iv; ./configure; make and will produce libtest.dll in ./.libs/

I believe all symbols are exported by default. Adding "-export-symbols symbol-file"
may be an easy way to customize it.

Selva

#4 lore raw

Thank you, Selva. After banging my head against the keyboard for the last 10 hours, only to find out I disposed the very solution you and David suggested because of a minor glitch not related to libtool and automake, I finally got it sorted out.

Best regards,

Simon

From: Selva Nair <[email protected]...>
Sent: Wednesday, October 10, 2018 5:55 PM
To: Simon Rozman <[email protected]...>
Cc: openvpn-devel <[email protected]>
Subject: Re: [Openvpn-devel] MinGW to build DLL not EXE

HI,

I have almost finished integrating tapctl.exe and openvpnmsica.dll utilities for MSI packaging into the OpenVPN/openvpn repo. However, I am totally new with MinGW and would need some help.

How do you tell the OpenVPN's build process to create a DLL file, not an EXE?

As with gcc mingw takes -shared option to create dll. But I guess you want to use autotools. If so:

In configure.ac <http://configure.ac> add "LT_INIT([win32-dll])" and a barebones Makefile.am would be

lib_LTLIBRARIES = libtest.la <http://libtest.la>
libtest_la_LDFLAGS = -no-undefined -avoid-version
libtest_la_SOURCES = test.c
libtest_la_CFLAGS = --std=c99

Run autoreconf -iv; ./configure; make and will produce libtest.dll in ./.libs/

I believe all symbols are exported by default. Adding "-export-symbols symbol-file"

may be an easy way to customize it.

Selva