digitalmars.D - DLLs/implib
- bobef (7/7) Sep 11 2005 After spending some time trying to find out how to run GTK+D+Windows (wi...
- Sean Kelly (5/12) Sep 11 2005 To work well, the tool would need to include a full C preprocessor, as C...
- bobef (5/24) Sep 11 2005 As much as I know there is no preprocessor in the .lib files... The only...
- Sean Kelly (4/8) Sep 11 2005 My mistake. I thought you wanted to parse the header files of libraries...
- John Reimer (15/24) Sep 11 2005 This has been discussed. I think everybody wants such a tool, and it is...
- bobef (10/25) Sep 11 2005 I can't see how it can slow down anything. I see it this way:
- Charles (11/18) Sep 11 2005 Yea that would be sweet , I know pragma has been working on something
- pragma (13/22) Sep 11 2005 DDL has support for gathering symbolic information from OMF .obj and
- John Reimer (6/38) Sep 11 2005 Eric... this is great, but I'm wondering how this works for c-based
After spending some time trying to find out how to run GTK+D+Windows (with no satisfying results) I thought of something... Is it possible to create a tool that makes headers files out of .lib-s. This would be great... Then we could just use implib/this tool and boom! And I am not talking only about GTK. Maybe there is no such tool because it is not possible or because it would be too easy? I doubt I am the first one to think of it. So what possibly could be the problems for creating such tool?
Sep 11 2005
In article <dg1sqq$2ulh$1 digitaldaemon.com>, bobef says...After spending some time trying to find out how to run GTK+D+Windows (with no satisfying results) I thought of something... Is it possible to create a tool that makes headers files out of .lib-s. This would be great... Then we could just use implib/this tool and boom! And I am not talking only about GTK. Maybe there is no such tool because it is not possible or because it would be too easy? I doubt I am the first one to think of it. So what possibly could be the problems for creating such tool?To work well, the tool would need to include a full C preprocessor, as C headers tend to include a lot of #defines and #ifdef logic. That aside, I agree that it would be quite useful. Sean
Sep 11 2005
Sean Kelly wrote:In article <dg1sqq$2ulh$1 digitaldaemon.com>, bobef says...As much as I know there is no preprocessor in the .lib files... The only thing I want from there is the function declarations... So you can directly use C a DLL. Sounds like a simple tool to me, but I know nothing of the .lib files format...After spending some time trying to find out how to run GTK+D+Windows (with no satisfying results) I thought of something... Is it possible to create a tool that makes headers files out of .lib-s. This would be great... Then we could just use implib/this tool and boom! And I am not talking only about GTK. Maybe there is no such tool because it is not possible or because it would be too easy? I doubt I am the first one to think of it. So what possibly could be the problems for creating such tool?To work well, the tool would need to include a full C preprocessor, as C headers tend to include a lot of #defines and #ifdef logic. That aside, I agree that it would be quite useful. Sean
Sep 11 2005
In article <dg1vbi$30lb$1 digitaldaemon.com>, bobef says...As much as I know there is no preprocessor in the .lib files... The only thing I want from there is the function declarations... So you can directly use C a DLL. Sounds like a simple tool to me, but I know nothing of the .lib files format...My mistake. I thought you wanted to parse the header files of libraries, not the lib files themselves. Sean
Sep 11 2005
bobef wrote:After spending some time trying to find out how to run GTK+D+Windows (with no satisfying results) I thought of something... Is it possible to create a tool that makes headers files out of .lib-s. This would be great... Then we could just use implib/this tool and boom! And I am not talking only about GTK. Maybe there is no such tool because it is not possible or because it would be too easy? I doubt I am the first one to think of it. So what possibly could be the problems for creating such tool?This has been discussed. I think everybody wants such a tool, and it is technically possible, I believe... although it seems that without some specialized optimization such a tool would slow compilation down significantly because of repeated lib parsing. Still, I've been waiting for this kind of tool to appear so that we can say D trully has headerless capabilities. That said, you might like to have a look at dynDUI's lib\Loader.d module (along with all the gtk modules in that directory). It loads symbols from the gtk dll's dynamically for both windows and linux so that you don't have to worry about linking with the gtk libraries. It works well as long as you have the dll's installed. The only drawback currently is that it doesn't include all gtk symbols yet. But those are easy to add on an "as needed" basis. -JJR
Sep 11 2005
John Reimer wrote:This has been discussed. I think everybody wants such a tool, and it is technically possible, I believe... although it seems that without some specialized optimization such a tool would slow compilation down significantly because of repeated lib parsing. Still, I've been waiting for this kind of tool to appear so that we can say D trully has headerless capabilities.I can't see how it can slow down anything. I see it this way: 1. download latest precompiled C DLL for GTK or whatever 2. use implib to get libraries out of it 3. use the new tool to get module with function declarations from the libraries 4. import the module and enjoy No repeated lib parsing or whatever. It will be repeated only when they make new versions...That said, you might like to have a look at dynDUI's lib\Loader.d module (along with all the gtk modules in that directory). It loads symbols from the gtk dll's dynamically for both windows and linux so that you don't have to worry about linking with the gtk libraries. It works well as long as you have the dll's installed. The only drawback currently is that it doesn't include all gtk symbols yet. But those are easy to add on an "as needed" basis.Thanks. I'll have a look...
Sep 11 2005
Yea that would be sweet , I know pragma has been working on something similar with object files : http://www.dsource.org/forums/viewforum.php?f=70 Charlie "bobef" <bobef_member pathlink.com> wrote in message news:dg1sqq$2ulh$1 digitaldaemon.com...After spending some time trying to find out how to run GTK+D+Windows (withnosatisfying results) I thought of something... Is it possible to create atoolthat makes headers files out of .lib-s. This would be great... Then wecouldjust use implib/this tool and boom! And I am not talking only about GTK.Maybethere is no such tool because it is not possible or because it would betooeasy? I doubt I am the first one to think of it. So what possibly could betheproblems for creating such tool?
Sep 11 2005
bobef wrote:After spending some time trying to find out how to run GTK+D+Windows (with no satisfying results) I thought of something... Is it possible to create a tool that makes headers files out of .lib-s. This would be great... Then we could just use implib/this tool and boom! And I am not talking only about GTK. Maybe there is no such tool because it is not possible or because it would be too easy? I doubt I am the first one to think of it. So what possibly could be the problems for creating such tool?DDL has support for gathering symbolic information from OMF .obj and .lib files. COFF support is on the way, and ELF support is planned in the near future. http://www.dsource.org/projects/ddl I am putting the final polish on the symbol demangler (based on James' code BTW) which will be released along with a rather sizable batch of improvements to this library. However, its all in a very raw state for the time being. I'd imagine that with the demangler code in place, you'll be practically home free. Heck, I may even make a stab at a header generator myself. -- - EricAnderton at yahoo
Sep 11 2005
pragma wrote:bobef wrote:Eric... this is great, but I'm wondering how this works for c-based libs. How do you get the parameter details for the functions? D based functions are easy since the parameter typs are mangled into the symbol name. I'm just curious how this will work for C-base libraries. -JJRAfter spending some time trying to find out how to run GTK+D+Windows (with no satisfying results) I thought of something... Is it possible to create a tool that makes headers files out of .lib-s. This would be great... Then we could just use implib/this tool and boom! And I am not talking only about GTK. Maybe there is no such tool because it is not possible or because it would be too easy? I doubt I am the first one to think of it. So what possibly could be the problems for creating such tool?DDL has support for gathering symbolic information from OMF .obj and .lib files. COFF support is on the way, and ELF support is planned in the near future. http://www.dsource.org/projects/ddl I am putting the final polish on the symbol demangler (based on James' code BTW) which will be released along with a rather sizable batch of improvements to this library. However, its all in a very raw state for the time being. I'd imagine that with the demangler code in place, you'll be practically home free. Heck, I may even make a stab at a header generator myself.
Sep 11 2005
John Reimer wrote:Eric... this is great, but I'm wondering how this works for c-based libs. How do you get the parameter details for the functions? D based functions are easy since the parameter typs are mangled into the symbol name. I'm just curious how this will work for C-base libraries.In short, it won't. Walter was nice enough to give D's symbol mangling some smarts so that function overloading works correctly. As for C functions, the best that can be done (for a header generator) is to emit a file that simply has them declared as something like this:extern(C) void* foobar; //TODO: change me (this means you)Which is a far cry from what we want, but is just about all you're going to get from the perspective of an .obj or .lib file. When you get down to it, the DDL suite is really tailored for mostly pure D code and binary data, so it's not a perfect fit here. For this case, I think the future will probably hold a special place for something that can parse .c and .h files to generate D symbol files. Its either that or we improve the current batch of .h to .d conversion utils. -- - EricAnderton at yahoo
Sep 11 2005
pragma wrote:John Reimer wrote:I found an article where they did it for C++. http://www.newlc.com/article.php3?id_article=530 The example was using nm from binutils but it requires COFF format and I couldn't manage to convert OMF to COFF. And if I did I am still not sure it would work. I don't know. Take a look. Maybe it will mean something more for you than me.Eric... this is great, but I'm wondering how this works for c-based libs. How do you get the parameter details for the functions? D based functions are easy since the parameter typs are mangled into the symbol name. I'm just curious how this will work for C-base libraries.In short, it won't. Walter was nice enough to give D's symbol mangling some smarts so that function overloading works correctly. As for C functions, the best that can be done (for a header generator) is to emit a file that simply has them declared as something like this: > extern(C) void* foobar; //TODO: change me (this means you) Which is a far cry from what we want, but is just about all you're going to get from the perspective of an .obj or .lib file. When you get down to it, the DDL suite is really tailored for mostly pure D code and binary data, so it's not a perfect fit here. For this case, I think the future will probably hold a special place for something that can parse .c and .h files to generate D symbol files. Its either that or we improve the current batch of .h to .d conversion utils.
Sep 12 2005
the difference is C++ has all the identifiers mangled to bake in the types and arguments, whereas in c all we get are function names. Ive got windows COFF code but unfortunately I dont see how this is really going to help for C modules. as eric said all you would produce is a list of function names. bobef wrote:pragma wrote:John Reimer wrote:I found an article where they did it for C++. http://www.newlc.com/article.php3?id_article=530 The example was using nm from binutils but it requires COFF format and I couldn't manage to convert OMF to COFF. And if I did I am still not sure it would work. I don't know. Take a look. Maybe it will mean something more for you than me.Eric... this is great, but I'm wondering how this works for c-based libs. How do you get the parameter details for the functions? D based functions are easy since the parameter typs are mangled into the symbol name. I'm just curious how this will work for C-base libraries.In short, it won't. Walter was nice enough to give D's symbol mangling some smarts so that function overloading works correctly. As for C functions, the best that can be done (for a header generator) is to emit a file that simply has them declared as something like this: > extern(C) void* foobar; //TODO: change me (this means you) Which is a far cry from what we want, but is just about all you're going to get from the perspective of an .obj or .lib file. When you get down to it, the DDL suite is really tailored for mostly pure D code and binary data, so it's not a perfect fit here. For this case, I think the future will probably hold a special place for something that can parse .c and .h files to generate D symbol files. Its either that or we improve the current batch of .h to .d conversion utils.
Sep 12 2005
On Sun, 11 Sep 2005 19:09:04 -0700, pragma <EricAnderton youknowthedrill.yahoo> wrote:John Reimer wrote:Someone should add D support to SWIG. This will allow us to make D wrappers of C and C++ libraries easily. http://www.swig.org/ I just posted an ideal, but related, solution a few minutes ago. -- kaiEric... this is great, but I'm wondering how this works for c-based libs. How do you get the parameter details for the functions? D based functions are easy since the parameter typs are mangled into the symbol name. I'm just curious how this will work for C-base libraries.In short, it won't. Walter was nice enough to give D's symbol mangling some smarts so that function overloading works correctly. As for C functions, the best that can be done (for a header generator) is to emit a file that simply has them declared as something like this:extern(C) void* foobar; //TODO: change me (this means you)Which is a far cry from what we want, but is just about all you're going to get from the perspective of an .obj or .lib file. When you get down to it, the DDL suite is really tailored for mostly pure D code and binary data, so it's not a perfect fit here. For this case, I think the future will probably hold a special place for something that can parse .c and .h files to generate D symbol files. Its either that or we improve the current batch of .h to .d conversion utils.
Jan 24 2006