Creating DLL from .a files

9

9GB

How can I convert a static library ".a" file to a DLL file?
I am using it with JNI. Writing methods in java and implementing in C
and then converting it back to a DLL but i cant find out how to make
dlls in GCC.
 
T

Tim Prince

9GB said:
How can I convert a static library ".a" file to a DLL file?
I am using it with JNI. Writing methods in java and implementing in C
and then converting it back to a DLL but i cant find out how to make
dlls in GCC.
This is possible only for specific targets, so is off topic for standard
C. It is certainly possible within cygwin and possibly mingw. If you
can't find their documentation, ask on the corresponding lists.
 
J

jacob navia

9GB said:
How can I convert a static library ".a" file to a DLL file?
I am using it with JNI. Writing methods in java and implementing in C
and then converting it back to a DLL but i cant find out how to make
dlls in GCC.

This is very easy

1) Extract all object files from the .a archive
2) use those files to build a dll.

You will have to add some files like an entry point
to build a dll but those can be empty.
 
D

Default User

9GB said:
I'm using MinGW version of GCC... your help would be really
appreciated.

It's off-topic here. Find a newsgroup for MinGW (Google Groups search
may help) or perhaps a forum or mailing list for that system.

Also:

Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>



Brian
 
M

Mark McIntyre

This is very easy

1) Extract all object files from the .a archive
2) use those files to build a dll.

You will have to add some files like an entry point
to build a dll but those can be empty.

I'm not sure whether this is a joke answer or not.

If you have a .a file from linux or unix, I doubt you can trivially
convert it into a Windows DLL by simply packaging the objects up with
some wrapper code. If you have a .a file from a windows compiler, why
not simply write a DLL in the first place? If you have a 3rd party
library in .a format you want to use as a DLL, then ask the 3rd party.
Either way, this is wildly offtopic here. Comp,unix.programmer for
the .a file format (possibly) and a windows group for the rest.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
K

Kenny McCormack

I'm not sure whether this is a joke answer or not.

It is not a joke (though it is of course wildly off-topic and for the
reasons often quoted here - which is that no one here can adequately
peer-review it, since they are all Unix bigots).

But here's the deal:
1) Since OP mentioned both .a files and DLLs, which are,
classically, creatures from different worlds, you have to
assume, as Jacob has done, that he (OP) is talking about
using a Unixy compiler in the Windows world. And, this
usually means either MinGW or Cygwin. Said Unixy compilers
end up speaking both the language of Unix (.a and .o files)
as well as the language of Windows (.EXEs and .DLLs).
2) Given the above, and, of course, assuming no access to source
(since that would make it trivial to simply re-compile from
scratch), the advice that Jacob gives is, modulo a detail
here or there (said details being, of course, in the dreaded
category known as "off topic"), correct.
 
O

Old Wolf

If you have a .a file from linux or unix, I doubt
you can trivially convert it into a Windows DLL

However you can semi-trivially convert it if it
is a .a file from Windows. The specification of
..a files says nothing about which ABI is used
for the object files it contains. In fact, the
files in a .a do not even have to be object files.

(BTW, that has to be one of the most bizarre
sequences I've ever written: "it if it is a a")
If you have a .a file from a windows compiler, why
not simply write a DLL in the first place?

It might be source code that's designed to be used
on multiple platforms.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top