Aye, rock it does.
--
Rob Hill
http://rob.runtothehills.org
From: win_tech_off_topic@yahoogroups.com
[mailto:win_tech_off_topic@yahoogroups.com] On Behalf Of Chris Tavares
Sent: 04 September 2008 20:19
To: win_tech_off_topic@yahoogroups.com
Subject: RE: [OT] convert a static lib to a dll?
I used SWIG in a past life to hook up
some C code to Python. It well and truly rocks.
-Chris
From:
win_tech_off_topic@yahoogroups.com [mailto:win_tech_off_topic@yahoogroups.com] On
Behalf Of Hugh Brown
Sent: Thursday, September 04, 2008 10:32 AM
To: win_tech_off_topic@yahoogroups.com
Subject: Re: [OT] convert a static lib to a dll?
|
If
that's the case, have you looked into SWIG? [1] SWIG
is a software development tool that connects programs written in C and C++
with a variety of high-level programming languages. SWIG is used with
different types of languages including common scripting languages such as
Perl, PHP, Python, Tcl and Ruby. The list of supported languages
also includes non-scripting languages such as C#, Common Lisp (CLISP, Allegro
CL, CFFI, UFFI), Java, Lua, Modula-3, OCAML, Octave and R. Also several
interpreted and compiled Scheme implementations (Guile, MzScheme, Chicken)
are supported. SWIG is most commonly used to create high-level interpreted or
compiled programming environments, user interfaces, and as a tool for testing
and prototyping C/C++ software. SWIG can also export its parse tree in the
form of XML and Lisp s-expressions. SWIG may be freely used, distributed, and
modified for commercial and non-commercial use.
From:
Scott Zionic <Scott.Zionic@...> I have the header file, so I know what the library exports. I am really looking for a tool to auto-generate the wrapper dll (the scripting part that you mention). It's not a big deal to do it by hand but it seems like a common enough thing that someone would have created a utility to automate it. This is a C dll, by the way. No name mangling. I just need a thin wrapper so I can PInvoke it. Oh well. I probably should have just written the script already. Shouldn't take too long. Hugh Brown wrote: > I think you Need to use DumpBin [1] to dump the contents of the LIB file. > The cited page does not show it, but I think that C++ code shows the > mangled function names when dumped. Then you'd convert the mangled names > to C++ function definitions. Then for every public function exposed, you'd > create a C++ DLL function that takes the same arguments and forwards the > call to the static library call. Then a .DEF file and a command line for > linkage and you're done. > > Yeah, you'd have to do script for part of this -- the demangling of > function prototypes, writing a source file of exported DLL functions, > writing a DEF file for the exports, writing the linkage. > > Does that help? > > Hugh > > [1] http://support.microsoft.com/kb/177429 > > > Check my new blog: http://www.IWebThereforeIAm.com/ > Subscribe at: http://www.IWebThereforeIAm.com/rss.xml > > --- On Thu, 9/4/08, Scott Zionic <Scott.Zionic@...> wrote: > From: Scott Zionic <Scott.Zionic@...> > Subject: [OT] convert a static lib to a dll? > To: win_tech_off_topic@yahoogroups.com > Date: Thursday, September 4, 2008, 10:30 AM > > I have a static library full of C functions without source code that I > want to convert to a dll so I can call it from C#. I know I can just > create a wrapper dll for it and re-export the functions but I was > wondering if there's some kind of utility that would do the drudgery for > me? > > Google shows a few tools for converting a dll to a static lib, but not the > other way around. > > Scott |