Jump to page: 1 2
Thread overview
DLLs/implib
Sep 11, 2005
bobef
Sep 11, 2005
Sean Kelly
Sep 11, 2005
bobef
Sep 11, 2005
Sean Kelly
Sep 11, 2005
John Reimer
Sep 11, 2005
bobef
Sep 11, 2005
Charles
Sep 11, 2005
pragma
Sep 12, 2005
John Reimer
Sep 12, 2005
pragma
Sep 12, 2005
bobef
Sep 12, 2005
J Thomas
Jan 25, 2006
kai
September 11, 2005
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?


September 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


September 11, 2005
Sean Kelly wrote:
> 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
> 
> 

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...
September 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
September 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...
September 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 (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?
>
>


September 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


September 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
September 12, 2005
pragma wrote:
> 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.
> 

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.

-JJR
September 12, 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
« First   ‹ Prev
1 2