I know this question has been asked many times, but I cannot find enough information to solve the problem.
I have a windows dll and header files. I want to make a library that I can link to and use on linux. What are the steps required to do this?
I have used winedump to generate a .spec file and winebuild to generate an assembly file. What comes next?
Thanks
On 8/30/06, Mark Smith mesmith.18885136@bloglines.com wrote:
I know this question has been asked many times, but I cannot find enough information to solve the problem.
I have a windows dll and header files. I want to make a library that I can link to and use on linux. What are the steps required to do this?
Sorry, you can't. Not at the moment, anyway. That's on the to-do list. - Dan
Dan Kegel wrote:
On 8/30/06, Mark Smith mesmith.18885136@bloglines.com wrote:
I know this question has been asked many times, but I cannot find enough information to solve the problem.
I have a windows dll and header files. I want to make a library that I can link to and use on linux. What are the steps required to do this?
Sorry, you can't. Not at the moment, anyway. That's on the to-do list.
It's not that black and white, is it?
I believe you can, and it actually works reasonably well. BUT there's a big catch - you have to make your program into a Winelib application.
That is, what you (reasonably) want is just a simple foo.so you can dlopen and then do invoke_my_windows_function().
You can get that, but what you have to do is rename your main to be linux_main, and then write a whole new WinMain which invokes your linux_main.
Then, from within your linux app, you can write some glue to make the connectiong.
You can get into trouble if you depend heavily on particular IPC mechanisms, threading in particular, but I believe that basic usages should still work.
So, basically, if you're willing to stand your application on its head, you can get the functionality you want.
Most people don't get over that; to be frank, I think those that don't are largely just stuck on the 'smell' of it; from a practical standpoint, I think it works fine.
Cheers,
Jeremy
On Friday 01 September 2006 03:52, Jeremy White wrote:
Dan Kegel wrote:
On 8/30/06, Mark Smith mesmith.18885136@bloglines.com wrote:
I have a windows dll and header files. I want to make a library that I can link to and use on linux. What are the steps required to do this?
Sorry, you can't. Not at the moment, anyway. That's on the to-do list.
It's not that black and white, is it?
I believe you can, and it actually works reasonably well. BUT there's a big catch - you have to make your program into a Winelib application.
Actually there's probably an easier way - a scheme I've been considering is one involving a crt0.o designed to load Wine (essentially making the native executable an equivalent of wine-pthread with other stuff), then start a Winelib program whose entry point calls back into a second entry point in the original executable. This scheme ought to work without any modifications to the core of Wine. We also wouldn't need to be reserving any memory areas, so the trimmed down operating system entry point of the Wine executable might be something like this:
int __wine_startup( int argc, char **argv, char **envp) { char error[1024]; char winelib_argv[3]; char wine_entry_addr[sizeof(void *) * 2 + 1];
__wine_argc = argc; __wine_argv = argv; __wine_envp = envp;
wine_pthread_set_functions( &pthread_functions, sizeof(pthread_functions) );
sprintf(wine_entry_addr, "%p", __wine_entry); winelib_argv[0] = "execallback.exe.so"; winelib_argv[1] 0;
wine_init( 2, winelib_argv, error, sizeof(error) ); fprintf( stderr, "wine: failed to initialize: %s\n", error ); exit(1); }
A routine "__wine_exe_entry_point" would be exported by the executable. The startup code for "excallback.exe.so" would call that routine as substantially all of its initialisation code, so that the executable calls wine_dll_register providing its own details.
I suspect the "difficulty" associated with having a Linux executable that calls Windows DLLs using Wine has been due the assumption that "main()" in the executable would be executed before Wine - by throwing out this assumption the problem may be a whole lot easier to solve.