Skip to search.
win_tech_off_topic · Windows Technical: Off Topic

Group Information

  • Members: 1036
  • Category: Windows
  • Founded: Jul 27, 2001
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

  Messages Help
Advanced
convert a static lib to a dll?   Message List  
Reply Message #58515 of 60294 |
RE: [OT] convert a static lib to a dll?

Another +1 for SWIG, I’ve used it to create wrappers for a  legacy Tuxedo DLL (C) to a DSL compiler I’d written in Java.

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.


I would have mentioned this earlier, but I forgot about this tool.

Hugh


[1] http://www.swig.org/


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: Re: [OT] convert a static lib to a dll?
To: win_tech_off_topic@yahoogroups.com
Date: Thursday, September 4, 2008, 11:16 AM

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



Fri Sep 5, 2008 4:14 pm

dead_neurons
Offline Offline
Send Email Send Email

Message #58515 of 60294 |
Expand Messages Author Sort by Date

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...
Scott Zionic
qwqertyuiopa... Offline Send Email
Sep 4, 2008
2:30 pm

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...
Hugh Brown
hughdbrown Offline Send Email
Sep 4, 2008
3:02 pm

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...
Scott Zionic
qwqertyuiopa... Offline Send Email
Sep 4, 2008
3:16 pm

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...
Hugh Brown
hughdbrown Offline Send Email
Sep 4, 2008
5:31 pm

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 ...
Chris Tavares
durgansmith Offline Send Email
Sep 4, 2008
7:18 pm

+1 for SWIG, although I've only used it to create JNI wrappers for Java....
Stoyan Damov
stoyan_damov Offline Send Email
Sep 4, 2008
7:36 pm

Yep - SWIG FTW!!! It's pretty much exactly what your looking for. j....
josh robb
josh_robb Offline Send Email
Sep 5, 2008
6:08 am

Another +1 for SWIG, I've used it to create wrappers for a legacy Tuxedo DLL (C) to a DSL compiler I'd written in Java. Aye, rock it does. -- Rob Hill ...
Rob Hill
dead_neurons Offline Send Email
Sep 5, 2008
4:15 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help