That's the part I'm struggling with. The:
g++ -o my_library.a -shared foo.o bar.o
I don't know how to do that to the makefile just yet. A day of
thrashing about yielded little. I sent an email to the original
author to help me get that particular line in the makefile.
The makefile I have creates 5 executables and 1 library. I think the
lines that need to be changed are:
$(AR) cr $@ $+
On Tue, Feb 22, 2011 at 10:40 PM, Greg Chicares <gchicares@...> wrote:
> On 2011-02-23 03:43Z, Mathew Benson wrote:
>> I get a periodically updated makefile and set of source to build a
>> static library in Linux. I got it to compile in mingw+msys, but I
>> can't figure out how to successfully make a DLL to be used in Visual
> First read this, if you haven't already:
> It's possible to mix C++ compilers, but the restrictions are severe,
> and in general it's much better to avoid this.
>> I can recommend changes to the project, but I'm not that well
>> versed with makefiles. I found a lot of help on this, but everything
>> I find assumes your compiling a simple single .cpp file.
> It sounds like you're simultaneously trying to learn 'make' and the
> MinGW gcc toolchain, while striving to link with msvc++. I'd suggest
> narrowing the focus and trying one thing at a time. For example:
> - First, using MinGW gcc only, build your DLL and a dummy program
> to call it, and verify that everything works correctly. Do each
> step at the command line.
> - Then turn your proven set of commands into a makefile.
> - Then replace the dummy with your actual application.
> - Then consider mixing gcc with msvc++, but I hope you decide not to.
>> I made changes to the source to tag functions for export. I understand
>> gcc and Visual C++ mangle c++ names differently, so I wrote a C
>> wrapper to call my C++ functions, and tagged those for export.
> That sounds sensible, so far.
>> I would prefer instructions for how to go from a .a file to a
>> functioning DLL. Can somebody help me?
> You can build a static library, but you want a DLL instead?
> Then change the linker command, e.g. replacing a command like
> ar -rus my_library.a foo.o bar.o
> g++ -o my_library.a -shared foo.o bar.o
> If you're using __declspec decorations, then presumably they're
> governed by some macro (export when building the DLL, and import
> when using it, but do neither for static libraries), so rebuild
> the objects with the appropriate macro definition first.
> Consider starting out with the most minimal test case--a DLL with
> just one trivial function, linked to an application that calls it
> in just one function. Then you can post the whole thing here, and
> anyone can easily reproduce any problem you run into, so you'll
> get lots of help.
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
> generated by your applications, servers and devices whether physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> MinGW-users mailing list
> This list observes the Etiquette found at
> We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
> You may change your MinGW Account Options or unsubscribe at:
> Also: mailto:mingw-users-request@...