8 4901 HW Oosterhout (NB)
13 WARNING: This HOWTO is incomplete. I expect to add to it on a weekly
14 basis until it is complete.
16 =====================================================================
20 I. Introduction: Wine vs. WineLib
26 IV. Compiling A Simple Win32 Program
28 V. Compiling A Win32 Program With Resources
36 A. Using a native MFC dll
40 Windows 3.x, Windows 95, Windows 98, Windows NT are trademarks of
41 Microsoft Corporation.
43 Unix is a trademark of ???? FIXME: who has the trademark this week?
45 CrypKey is a trademark of Kenonic Controls Ltd.
47 All other trademarks are the property of their respective owners.
49 =====================================================================
51 I. Introduction: Wine vs. WineLib
53 Wine/Winelib provides the Win32/Win16 API's to a non-Microsoft
54 operating system. The wine/winelib Win32/Win16 functions use X11
55 functions to perform the actual drawing on the screen. Wine and
56 winelib are based on the same set of functions that implement the
57 Win32/Win16 API. The difference between wine and winelib is the type
58 of executable that is loaded into memory and executed. If an
59 executable and any associated DLLs were compiled for x86 hardware
60 running the Windows 3.x, 95, 98, or Windows NT (TM) operating systems,
61 then Wine can use a special binary loader to load the program and the
62 libraries into memory and execute it. Winelib on the other hand allows
63 you to take the source for such a program and DLLs and compile it into
64 the native format of a x86 Unix or Linux operating system. Winelib
65 also allows you to partially compile the program and DLLs into the
66 native format. For example, if you use a DLL from a vendor to provide
67 some functions to your program and the vendor does not give you
68 source, then you can use the Windows version of the DLL to provide the
69 functions and compile the rest of your program in the native form for
72 Windows compilers assume a different structure than standard
73 compilers. For example, standard compilers assume that the function
74 main() exists and is the entry point of the program. On the other
75 hand, windows compilers create a main() that issues an error message
76 that states that windows is required for executing the program and the
77 real entry point is the function WinMain(). As a result, winelib
78 provides certain aids to generate code so that your program can be
79 compiled and run as written for windows. For example, winelib
80 generates a main() to initialize the windows API, to load any
81 necessary DLLs and then call your WinMain(). Therefore you need to
82 learn four basic operations to compile a windows program using
83 winelib: compiling a simple program, compiling resources, compiling
84 libraries, and compiling MFC. These skills are operations are
85 explained in later sections of this HOWTO.
87 Before you start porting your windows code to winelib, you need to
88 consider whether you are allowed to port your program to winelib. As
89 you compile your program using winelib, you will be combining software
90 from several sources and you need to ensure that the licenses for the
91 components is compatible. Hence in the next section, we will examine
96 Disclaimer! I am not a lawyer. The purpose of this section is to make
97 you aware of potential legal problems. Be sure to read your licenses
98 and to consult your attorney.
100 During the compilation of your program, you will be combining code
101 from several sources: your code, winelib code, code from your vendor's
102 DLLs (if any), and Microsoft MFC code (if used). As a result, you must
103 ensure that the licenses of all code sources are obeyed. What you are
104 allowed and not allowed to do can vary depending on how you compile
105 your program and if you will be distributing it. For example, if you
106 are releasing your code under the GPL, you cannot link your code to
107 MFC code because the GPL requires that you provide ALL sources to your
108 users. The MFC license forbids you from distributing the MFC source so
109 you can not comply with the GPL license except by not distributing you
110 program. On the other hand, if your code is released under the LGPL,
111 you cannot statically link your program to MFC and distribute it, but
112 you can dynamically link your LGPL code and MFC code and distribute
115 Wine/Winelib is distributed under an X11-like license. It places few
116 restrictions on the use and distribution of Wine/Winelib code. I doubt
117 the Wine license will cause you any problems. On the other hand MFC is
118 distributed under a very restrictive license and the restrictions vary
119 from version to version and between service packs.
121 If you plan on using MFC, there are three hurdles to legally using
122 MFC. The first hurdle is how to legally get MFC source code on your
123 computer. MFC source code comes as a part of Visual Studio. The
124 license for Visual Studio implies it is a single product that can not
125 be broken up into its components. The cleanest way to get MFC on you
126 system is to use a dual boot Linux box with the windows partition
127 visible to the Linux OS. Boot into windows and install Visual
128 Studio. Since Visual Studio is installed on the computer, you have not
129 broken it into its components. There may be other solutions, but I
130 think this is the easiest.
132 The second hurdle for MFC is the legality of compiling MFC on a
133 non-Microsoft operating system. This varies with the version of MFC.
135 MFC license from Visual Studio 6.0:
137 1.1 General License Grant. Microsoft grants to you as an
138 individual, a personal, nonexclusive license to make and use
139 copies of the SOFTWARE PRODUCT for the sole purposes of designing,
140 developing, and testing your software product(s) that are designed
141 to operate in conjunction with any Microsoft operating system
142 product. [Other unrelated stuff deleted.]
144 So it appears you cannot compile MFC for Winelib using this
145 license. On the other hand, Visual Studio 6.0 service pack 3 (Visual
146 Studio 5.0 is similar):
148 1.1 General License Grant. Microsoft grants to you as an
149 individual, a personal, nonexclusive license to make and use
150 copies of the SOFTWARE PRODUCT for the purpose of designing,
151 developing, and testing your software product(s). [Other unrelated
154 So it appears you can compile MFC for Winelib using this license.
156 The third hurdle is your legal right to distribute an MFC
157 library. Check the relevant section of the license on redistributables
158 and your redistribution rights. As I read the license, you only have
159 the right to distribute binaries of the MFC library if it has no debug
160 information and if you distribute it with an application that provides
161 significant added functionality to the MFC library.
163 Once you have examined the licenses for all of the sources used in
164 compiling your program and have decided you can legally compile you
165 program using winelib, you should probably experiment with your
166 program running under wine to determine how much work will be involved
167 in the port. The next section will give advice on estimating the
168 amount of work required for porting your program to winelib.
172 Wine and winelib use the same functions to implement the windows API;
173 hence, if your program correctly runs under wine, it should run under
174 winelib. However, wine/winelib is incomplete. You may have trouble
175 running your program under wine. Many people have successfully run many
176 programs under wine, so there is a good chance you will have no
179 Wine executes the binary program that was compiled for a windows
180 operating system. There are differences between the windows operating
181 system and Unix/Linux operating systems. For example, in Windows 3.x,
182 Windows 95, and Windows 98, the program has direct access to the
183 hardware. A copy protection program that you purchased for your
184 windows executable may use direct hardware access to write data to the
185 disk. Hence, you may need to disable the copy protection in order to
186 test your executable under wine.
188 As a specific example, CrypKey is a copy protection program we use at
189 Lumin Software. Our program does not execute under wine with the copy
190 protection enabled. We disabled the copy protection, recompiled the
191 windows executable, and our program works fine. CrypKey also works for
192 Windows NT where it creates a service. Using wine with the --winver
193 nt40 option "almost" gets the our program working with copy
194 protection. At a later date, we intend to either implement the system
195 calls in wine that are missing for CrypKey or to use another copy
196 protection program that does work under Linux.
198 During the execution of your program, wine prints error messages to
199 standard error. These error messages include "stubs", which are
200 windows API functions that have not been completely
201 implemented. Depending on the the system call, these could be harmless
202 or crash your program. Most of the common windows API functions have
203 already been implemented, so you should have no missing API functions
204 or only a few missing functions. If you intend to continue with the
205 port to winelib, you will need to implement these API
206 functions. After running your program for a while, you should have a
207 good feel for the number of windows API functions that you need to
210 It is not necessary for you to implement the entire documented
211 behavior of an API function in order to get your program to work. For
212 example, many API functions have pointer parameters that are NULL in
213 the common cases. If you always call the function with a NULL pointer
214 for the default behavior, you can save yourself some effort by
215 implementing a function that only works for the NULL pointer
216 parameter. If you do this, make sure you test if the parameter is
217 non-null and issue a warning for the non-null case. Also document in
218 the source that the API function is incomplete.
220 Once you have implemented an API function, submit the change back to
221 the wine project so the next person to need the same function does not
222 need to repeat your work. Remember, someone else wrote all of the
223 other API functions that you are using, so you are benefiting from
224 their work. Let other people benefit from your work as well. If you
225 work for a company, you may need your company's permission to "give
228 IV. Compiling A Simple Win32 Program
230 Wine and Winelib are written in C as is the MS Win32/16 API; thus, if
231 have a program that calls only the Win32 API directly, you can compile
232 the program using a C compiler and link it with some of the
233 wine/winelib libraries. For examples of how to do this, see the
234 directory libtest/ in the wine source tree.
236 FIXME: to be continued.
238 Go through hello world example 1 and 2.
240 V. Compiling A Win32 Program With Resources
242 FIXME: to be continued.
244 Go through hello world example 3.
251 FIXME: to be continued.
252 QUESTION: what are so DLL and elfdll. I think I have been doing so
255 Go over an example similar to edrlib in Petzold.
258 A. Using a native MFC dll
261 FIXME: to be continued.
263 =====================================================================
264 The information included here is from various wine-devel posting and
265 private e-mails. I am including them so that any one starting on MFC
266 will have some documentation. Glean what you can and good luck.
268 Before I write more detailed info on compiling MFC I have three
269 questions. The info I have mentions three problems:
271 1. wine header files---what is the status of this? Do changes need
272 to be made in the headers and if so, do I submit the changes back
273 into wine cvs? Do the changes need #ifdef for C vs. C++
276 2. DOS format files <CR/LF> and no case distinction in
277 filenames. Do the extensions Corel made to gcc 2.95 handle this?
280 3. Microsoft extensions to the C++ syntax. Do the extensions Corel
281 made to gcc 2.95 handle this? If so, how?
283 If you have info that needs to be added, send me email at
284 <wilbur.dale@lumin.nl> and I will add it.
286 =====================================================================
290 Most of the information in this file came from postings on
291 <wine-devel@winehq.com> and from private e-mails. The following people
292 contributed information for this document and I thank them for their
293 time and effort in answering my questions. I also want to thank them
294 for encouraging me to attack the MFC problem.
298 Damyan Ognyanoff <Damyan@rocketmail.com>
299 Gavriel State <gav@magmacom.com>
300 Ian Schmidt <ischmidt@cfl.rr.com>
301 Jeremy White <jwhite@codeweavers.com>
304 From: Ian Schmidt <ischmidt@cfl.rr.com>
305 Subject: Re: WineLib and MFC
307 "Wilbur N. Dale" wrote:
309 > What is the status of MFC under winelib?
311 I don't know precisely. Corel has done more MFC work than anyone (all
312 of their applications which they are porting are MFC-based), and
313 reportedly they have MFC itself compiled. I was just trying to get a
314 moderately simple MFC-using app to compile, with moderate success
315 (there are still some problems with MFC's headers after my patch, but
316 at least they don't appear to be Wine's fault :) I did not try to
319 > Which versions of MFC, if any?
321 I have no idea what version Corel uses. As noted in my patch, I was
322 fiddling with the headers for MFC 6 (from Visual C++ 6.0 Service Pack
323 3). Most of the stuff my patch addressed was for newer IE 5-related
324 features, so I'd guess MFC 5 (VC++ 5.0) is likely what they used.
326 > Is there any documentation on how to compile MFC for winelib? If so
331 > I have started to compile programs using winelib (hello.c last
332 > Sunday) and expect to be ready to start compiling MFC in a couple of
333 > weeks. If documentation is not available on compiling MFC, I am
334 > willing to write it.
336 Documentation would be a Good Thing, as WineLib in general is grossly
337 underdocumented right now. Here's a few tips I discovered to get you
340 - First off, run all the MFC headers (and source too if you try it)
341 through a utility to strip out the DOS carriage returns. They cause
342 havoc with GCC when it sees one after a line that ends with a \ (and
343 MFC has many macros in it's headers that meet that description). If
344 you don't have one, do a Google search on "fromdos" and you should
345 locate some source (or it's fairly easy to make your own).
347 - Use GCC 2.95.2, and the -fpermissive flag to make it less picky.
348 2.95.2 has some VC++-compatibility features that Corel paid for, and I
349 believe more are forthcoming in future GCCs.
351 - Use -I to add whereever you have the MFC headers at to your include
352 path, as MFC apps typically use #include <> to access them rather than
355 - Be prepared to have to rename and/or symlink headers, unless you
356 compile on a case-insensitive filesystem :)
358 - When you make install Wine it seems not to include all it's headers
359 in /usr/local/include/wine. To have any chance at getting MFC going
360 you'll want to use -I to add the include/ directory from the Wine
361 source tarball to the path so it can grab everything.
363 Sorry I can't help you more, but good luck!
369 From: Jeremy White <jwhite@codeweavers.com>
370 Subject: Re: RFC: Wine 1.0
372 "Wilbur N. Dale" wrote:
373 > > Further, we have successfully built MFC after making only
374 > > a modest set of changes to it, even with older
377 > Lumin Software is about to use winelib to port a window program to linux. A
378 > couple of years ago we thought we had to make a modification to MFC for one
379 > of our projects and we had problems getting MFC to compile under MS Visual C++.
380 > After much wailing and gnashing of teeth, we gave up and did things another
381 > way. After this bad experience, we were wondering --- approximately how many
382 > man-hours did you spend compiling and changing MFC ?
384 Urk. I misspoke. None of the developers here that I thought
385 had working versions of MFC with Wine have working versions any
386 longer. So, it may be a bit trickier than I led you to believe.
388 We have it working pretty reliably with Twine, but not
389 quite so cleanly (yet) with Wine. However, it really shouldn't
390 be too difficult, and this is what I can remember of the process:
392 1. If you use a very modern version of gcc (2.95.2 or higher),
393 I believe you will need to add the -relaxed flag to
394 have any hope of compiling.
396 2. If you use an earlier version of gcc, you will need to
397 adjust the many anonymous structs/unions that MFC supplies.
398 We prefer this approach, because requiring very
399 modern gcc implementations seems harsh to us.
401 3. You will need to adjust for the many type differences
402 between MFC intrinsic types and the types supplied by Wine.
403 For example, I believe that MFC expects a HANDLE to
404 be compatible with certain scalar types, (and it is
405 under Windows/VC, but is not with Wine/gcc).
407 4. The key procedure: add many -DNO_XXX flags to the
408 makefile. If you start with Microsofts make file
409 for MFC, convert it into a Wine makefile, and then turn
410 on many of the flags they list there (of the form -DNO_XXX),
411 your life will get much easier. Once you get it working
412 with a few -DNO_XXX flags, you can go back and add them
415 5. The best resource: you need someone who knows C++ very,
416 very well. You occassionaly run into very obscure C++
417 problems where MS has extended the C++ standard and
418 gcc has not. It really helps to have a guru on hand
422 I hope this helps. Sorry for the earlier deceptive post.
426 From: Gavriel State <gav@magmacom.com>
427 Subject: Re: MFC questions
429 "Wilbur N. Dale" wrote:
431 > 1. Compile MFC. Several years ago we (Lumin Software) tried to
432 > compile MFC. The attempt failed and we found another way to do what
433 > we wanted. MS documentation states that compiling MFC was
434 > deliberately made difficult. Considering my experience with stuff
435 > they call "easy" I am not looking forward to compiling MFC. We are
436 > currently using Visual Studio 5 for windows development.
438 At Corel, we had MFC compiled and running sample apps in WineLib in
439 late 1998. It's mostly a question of the Wine headers, which weren't
440 originally up to snuff. We did quite a bit of work on them, and most
441 of those changes have been contributed back to WineHQ, so it should be
442 pretty easy now. The other thing that was a big deal was getting the
443 startup code working properly - since MFC needs to initialize static
444 data *after* WineLib gets initialized. I believe that that issue has
445 been addressed now on the WineHQ side with some of the work done on
446 the .spec file tools recently.
453 TransGaming Technologies Inc.
456 From: Jeremy White <jwhite@codeweavers.com>
457 Subject: Re: MFC questions
459 "Wilbur N. Dale" wrote:
461 > 1. Compile MFC. Several years ago we (Lumin Software) tried to
462 > compile MFC. The attempt failed and we found another way to do what
463 > we wanted. MS documentation states that compiling MFC was
464 > deliberately made difficult. Considering my experience with stuff
465 > they call "easy" I am not looking forward to compiling MFC. We are
466 > currently using Visual Studio 5 for windows development.
468 Wilbur, I personally think that this is the 'right' approach, although
469 approach #2 may prove faster.
471 Despite your previous experience, and despite my earlier incorrect
472 statements, I think that this is simpler than you fear. It's one of
473 those tasks that's darkest before the storm - you spend all of your
474 energy getting all the include files to work. Once you have *one*
475 object file, the rest go much more quickly (alright, getting it to
476 link is also a hairball of a job, but it's tractable <g>).
478 If you're not in a hurry, getting MFC to compile, and having a
479 documented procedure for compiling it is on our agenda for the
480 relatively near future (see the Wine 1.0 task list).
484 p.s. Stick with Visi C++ 5. IMHO its MFC license is cleaner than that
487 From: Gavriel State <gav@magmacom.com>
488 Subject: The MSVC++ 6.0 license
491 > p.s. Stick with Visi C++ 5. IMHO its MFC license is cleaner than that
494 Actually, I just picked up a copy of MSVC 6.0 and it appears that they
495 changed the license between the original release and the Service Pack
496 3 release - they removed the bit in section 1.1 about requiring that
497 you be developing your software product only for use with a Microsoft
498 OS. In any case, even the original license explicitly says that the
499 MFC redistribution rights are *in addition* to the usage rights in
502 The relevant portion of the original EULA:
504 1.1 General License Grant. Microsoft grants to you as an individual, a
505 personal, nonexclusive license to make and use copies of the SOFTWARE
506 PRODUCT for the sole purposes of designing, developing, and testing your
507 software product(s) that are designed to operate in conjunction with
508 any Microsoft operating system product. [Other unrelated stuff deleted]
512 3. Section 1.1 of the EULA is deleted in its entirety and replaced
515 1.1 General License Grant. Microsoft grants to you as an individual, a
516 personal, nonexclusive license to make and use copies of the SOFTWARE
517 PRODUCT for the purpose of designing, developing, and testing your
518 software product(s). [Other unrelated stuff deleted]
520 Disclaimer - I am not a lawyer, but I've spent lots of time with them
521 investigating software licenses.
528 TransGaming Technologies Inc.
531 From: Damyan Ognyanoff <Damyan@rocketmail.com>
536 I manage to build mfc42 as .so library and a application using it (as
537 a .so library too). I execute it using simple loader which is linked
538 to wine and I load my application in it's WinMain routine. The
539 problem is how clearly to unload mfc and my application (to invoke
540 mfc's destructors before loader is terminated) All is fine except that
541 there is a "zombi" reference to code in shared library which is
542 invoked in wine code and generate GPF. debugger stops somewhere in
543 aplication's InitInstance !!! - and the stack is broken so I can't
544 catch where exactly the problem is. Any hints are welcome. I'm using
545 wine-2000517 shapshot downloaded form wine.datapary.no
551 If any of You is interested in details I can share my
555 From: Damyan Ognyanoff <Damyan@rocketmail.com>
556 Subject: Re: Wine MFC info request
559 my MFC is from VC6.0 with SP3
560 MFC Bulid: (form afxbld_.h)
561 #define _MFC_BUILD 8447
562 #define _MFC_USER_BUILD "8447"
565 FILEVERSION 6,0,_MFC_BUILD,_MFC_RBLD
566 PRODUCTVERSION 6,0,0,0
569 1. wine include files
571 In some of them you will find error about '__attribute__' all kinds of
572 similar errors can be fixed using proper typedefs first example :
574 typedef BOOL (CALLBACK *DLGPROC)(HWND,UINT,WPARAM,LPARAM);
578 typedef BOOL CALLBACK (*DLGPROC)(HWND,UINT,WPARAM,LPARAM);
580 and the second kind is something like
582 TYPE* WINAPI SomeFunction(HWND param1,UINT param2);
584 The problem here is a TYPE* or TYPE& (in some of mfc files) the
585 workaround is to declare a type before:
587 typedef TYPE* TYPEPtr;
591 typedef TYPE& TYPERef;
593 and declaration will look like:
595 TYPEPtr WINAPI SomeFunction(HWND param1,UINT param2);
597 note: don't miss a 'struct' when you define struct type pointers. I
598 miss it and get a lot of problems compiling MFC:
602 typedef !!!struct!!! _TEB* P_TEB;
603 extern inline P_TEB WINAPI NtCurrentTeb(void);
606 Those conversions are semanticaly the same as above but g++ compile
607 them and generate proper code to invoke __stdcall kind of functions
609 in some of wine/obj_XXX.h files: wine/obj_base.h - there are a lot of
610 defines's that are used to declare a COM interfaces
612 #define ICOM_METHOD(ret,xfn) \
613 public: virtual ret (CALLBACK xfn)(void) = 0;
615 will be (for all of them that are related to C++ (watch #ifdef's
618 #define ICOM_METHOD(ret,xfn) \
619 public: virtual ret CALLBACK (xfn)(void) = 0;
621 and the second tip is an error when compiler stops on line like:
623 ICOM_DEFINE(ISomeInterfase,IUnknown)
625 watch method declarations above to find something like:
627 ICOM_METHOD1(TYPE*,MethodName, DWORD,dwParam)
629 and replace TYPE* with proper TYPEPtr type. In many cases You will see
630 void* which can be replaced simply by LPVOID.
632 qthere are several errors related to anonymous structs and unions but
633 they can be avoided with proper - #ifdef __cplusplus
635 This is all about wine headers I think. If you find something that I
636 miss type a line of mail to me.
639 The rules are the same with some new issues:
641 virtual BOOL Method1(int param1, BOOL (CALLBACK *param2)
642 (HWND,UINT,WPARAM,LPARAM));
644 don't compile. I remove a function pointer declaration
647 typedef BOOL CALLBACK
648 (*param2Type)(HWND,UINT,WPARAM,LPARAM);
650 virtual BOOL Method1(int param1, param2Type param2);
652 I didn't apply this technique to a operator new
655 void* AFXAPI operator new(size_t nSize);
657 so i remove AFXAPI from these declarations:
659 I got some missed #defines from commctrl.h and I added
660 them form VC6.0 include.
662 these are my defines form Makefile which I used to
665 -DTWINE_NO_CMONIKER \ -- this is related to exclude
667 -D__urlmon_h__ \ -- wine didn't have URL interfaces
668 -D_AFX_NO_OLEDB_SUPPORT \
670 -DNOWIN98 \ -- this is used to exclude all
671 unimplemented classes from commctrl
673 -D_AFX_NO_DHTML_SUPPORT \
674 -D_AFX_NO_SOCKET_SUPPORT \
675 -D_AFX_NO_SYNC_SUPPORT \
676 -D_AFX_NO_OCX_SUPPORT \
678 -D_AFX_OLD_EXCEPTIONS \
679 -D_AFX_NO_SOCKET_SUPPORT \
680 -D_AFX_NO_DEBUG_CRT \
681 -D_AFX_NO_DAO_SUPPORT \
682 -D_AFX_NO_OCC_SUPPORT \
683 -D_AFX_NO_INET_SUPPORT \
684 -D_AFX_NO_RICHEDIT_SUPPORT \
688 may be you will try to enable some of features of mfc I tested only
689 -D_AFX_NO_OCC_SUPPORT but got missing interfaces from wine
692 - _CIP<_Interface, _IID>::~_CIP<_Interface, _IID>()
693 + _CIP<_Interface, _IID>::~_CIP()
696 - BOOL Lookup(BASE_CLASS::BASE_ARG_KEY key,
698 - { return BASE_CLASS::Lookup(key,
699 (BASE_CLASS::BASE_VALUE&)rValue); }
700 + BOOL Lookup(typename BASE_CLASS::BASE_ARG_KEY
701 key, VALUE& rValue) const
702 + { return BASE_CLASS::Lookup(key,
703 (typename BASE_CLASS::BASE_VALUE&)rValue); }
705 and all releated errors can be fixed in this way.
712 10 stdcall WinMain(long long ptr long) WinMain
715 use -rdynamic wnen link libmfc.so to get ARGV and
718 5. I didn'n build a extention dll with wine but I suspect that there
719 will be some problems releated to a chaining Runtime classes form MFC
722 6. build your app as a MODULE too.
724 7. make a loader and in it's _WinMain:
725 ... includes are here
726 iint PASCAL (*winMain)(HINSTANCE,HINSTANCE,LPSTR,int) =
728 my app uses these to manage filenames
729 VOID __cdecl (*_splitpath1)(LPCSTR path, LPSTR drive,
730 LPSTR directory, LPSTR filename, LPSTR extension ) =
732 VOID __cdecl _splitpath(LPCSTR path, LPSTR drive,
733 LPSTR directory, LPSTR filename, LPSTR extension )
736 _splitpath1(path, drive, directory, filename,
739 VOID __cdecl (*_makepath1)(LPSTR path, LPCSTR drive,
740 LPCSTR directory, LPCSTR filename, LPCSTR extension )
742 VOID __cdecl _makepath(LPSTR path, LPCSTR drive,
743 LPCSTR directory, LPCSTR filename, LPCSTR extension )
746 _makepath1(path, drive, directory, filename,
749 int PASCAL _WinMain(HINSTANCE h,HINSTANCE h1,LPSTR
752 HINSTANCE hInstance,hins,hlib,htst,hform,himag,hexe;
755 hins = LoadLibrary("CRTDLL.DLL");
756 _splitpath1 = GetProcAddress(hins,
758 _makepath1 = GetProcAddress(hins,
760 hins = LoadLibrary("COMCTL32.DLL");
761 hins = LoadLibrary("COMDLG32.DLL");
764 hins = dlopen("libmfc42.so",2);
765 hlib = LoadLibrary("mfc42");
766 himag = dlopen("libmxformatslib.so",2);
767 hform = LoadLibrary("mxformatslib");
768 hexe = dlopen("libmxpaint.so",2);
769 htst = LoadLibrary("mxpaint");
771 winMain = GetProcAddress(hlib, "WinMain");
774 retv = winMain (htst, // note the > htst
788 the spec for loader is:
794 please find attached a Makefile which i use to build
800 LocalWords: elfdll wrc devel cvs ifdef CR LF Corel gcc Damyan Ognyanoff app
801 LocalWords: Gavriel MFC's Wine's IE VC underdocumented Google fromdos GCCs SP
802 LocalWords: fpermissive whereever apps symlink filesystem tarball RFC linux
803 LocalWords: Urk misspoke structs DNO XXX Microsofts occassionaly WineHQ Gav
804 LocalWords: TransGaming alright hairball Jer Visi IMHO MSVC EULA mfc mfc's rc
805 LocalWords: destructors zombi GPF aplication's InitInstance shapshot TNX RBLD
806 LocalWords: Bulid afxbld mfcdll FILEVERSION PRODUCTVERSION BOOL CALLBACK HWND
807 LocalWords: DLGPROC UINT WPARAM LPARAM WINAPI SomeFunction param TYPEPtr TEB
808 LocalWords: TYPERef struct NtCurrentTeb semanticaly stdcall obj defines's COM
809 LocalWords: ICOM ret xfn ifdef's ISomeInterfase IUnknown MethodName DWORD int
810 LocalWords: dwParam LPVOID qthere cplusplus AFXAPI nSize commctrl DTWINE URL
811 LocalWords: CMONIKER CMonikerFile urlmon AFX OLEDB DNOWIN DHTML SYNC OCX DAO
812 LocalWords: OCC INET RICHEDIT DLONGHANDLES afxcom CIP IID afxtempl ARG rValue
813 LocalWords: const typename releated rsrc ptr rdynamic wnen libmfc ARGV ARGC
814 LocalWords: didn'n extention iint winMain HINSTANCE LPSTR cdecl splitpath SW
815 LocalWords: LPCSTR makepath lpszCmdParam hInstance hins hlib htst hform himag
816 LocalWords: hexe retv LoadLibrary CRTDLL GetProcAddress COMCTL COMDLG dlopen
817 LocalWords: libmxformatslib mxformatslib libmxpaint mxpaint FreeLibrary init
818 LocalWords: dlclose guiexe