Fixed generation of makefiles and wrapper files when "--wrap" option

is used.
This commit is contained in:
Juraj Hercek 2003-04-08 19:42:30 +00:00 committed by Alexandre Julliard
parent 6de2696ec5
commit 8df180a624
1 changed files with 26 additions and 25 deletions

View File

@ -1001,7 +1001,7 @@ sub postprocess_targets()
@$wrapper[$T_TYPE]=@$target[$T_TYPE]; @$wrapper[$T_TYPE]=@$target[$T_TYPE];
@$wrapper[$T_INIT]=get_default_init(@$target[$T_TYPE]); @$wrapper[$T_INIT]=get_default_init(@$target[$T_TYPE]);
@$wrapper[$T_FLAGS]=$TF_WRAPPER | (@$target[$T_FLAGS] & $TF_MFC); @$wrapper[$T_FLAGS]=$TF_WRAPPER | (@$target[$T_FLAGS] & $TF_MFC);
@$wrapper[$T_DLLS]=[ "kernel32.dll", "user32.dll" ]; @$wrapper[$T_DLLS]=[ "kernel32", "user32" ];
push @{@$wrapper[$T_LIBRARIES]}, "dl"; push @{@$wrapper[$T_LIBRARIES]}, "dl";
push @{@$wrapper[$T_SOURCES_C]},"@$wrapper[$T_NAME]_wrapper.c"; push @{@$wrapper[$T_SOURCES_C]},"@$wrapper[$T_NAME]_wrapper.c";
@ -1650,9 +1650,10 @@ sub generate_wrapper_file($$)
my $path=$_[0]; my $path=$_[0];
my $target=$_[1]; my $target=$_[1];
my $app_name=@$target[$T_NAME]; my $app_name=@$target[$T_NAME];
$app_name=~ s/\.exe$//; my $wrapper_name=$app_name;
$app_name=~ s/\.exe$/\.dll/;
return generate_from_template("$path${app_name}_wrapper.c","wrapper.c",[ return generate_from_template("$path${wrapper_name}_wrapper.c","wrapper.c",[
["APP_NAME",$app_name], ["APP_NAME",$app_name],
["APP_TYPE",(@$target[$T_TYPE]==$TT_GUIEXE?"GUIEXE":"CUIEXE")], ["APP_TYPE",(@$target[$T_TYPE]==$TT_GUIEXE?"GUIEXE":"CUIEXE")],
["APP_INIT",(@$target[$T_TYPE]==$TT_GUIEXE?"\"WinMain\"":"\"main\"")], ["APP_INIT",(@$target[$T_TYPE]==$TT_GUIEXE?"\"WinMain\"":"\"main\"")],
@ -3238,35 +3239,35 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
int WINAPI main(int argc, char** argv, char** envp) int WINAPI main(int argc, char** argv, char** envp)
#endif #endif
{ {
void* appLibrary; /*void* appLibrary;*/
HINSTANCE hApp = 0, hMFC = 0, hMain = 0; HINSTANCE hApp = 0, hMFC = 0, hMain = 0;
void* appMain; void* appMain;
char* libName; /*char* libName;*/
int retcode; int retcode;
/* Load the application's library */ /* Load the application's library */
libName=(char*)malloc(2+strlen(appName)+3+1); /*libName=(char*)malloc(2+strlen(appName)+3+1);*/
/* FIXME: we should get the wrapper's path and use that as the base for /* FIXME: we should get the wrapper's path and use that as the base for
* the library * the library
*/ */
sprintf(libName,"./%s.so",appName); /*sprintf(libName,"./%s.so",appName);*/
appLibrary=dlopen(libName,RTLD_NOW); /*appLibrary=dlopen(libName,RTLD_NOW);*/
if (appLibrary==NULL) { /*if (appLibrary==NULL) {*/
sprintf(libName,"%s.so",appName); /*sprintf(libName,"%s.so",appName);*/
appLibrary=dlopen(libName,RTLD_NOW); /*appLibrary=dlopen(libName,RTLD_NOW);*/
} /*}*/
if (appLibrary==NULL) { /*if (appLibrary==NULL) {*/
char format[]="Could not load the %s library:\r\n%s"; /*char format[]="Could not load the %s library:\r\n%s";*/
char* error; /*char* error;*/
char* msg; /*char* msg;*/
error=dlerror(); /*error=dlerror();*/
msg=(char*)malloc(strlen(format)+strlen(libName)+strlen(error)); /*msg=(char*)malloc(strlen(format)+strlen(libName)+strlen(error));*/
sprintf(msg,format,libName,error); /*sprintf(msg,format,libName,error);*/
MessageBox(NULL,msg,"dlopen error",MB_OK); /*MessageBox(NULL,msg,"dlopen error",MB_OK);*/
free(msg); /*free(msg);*/
return 1; /*return 1;*/
} /*}*/
/* Then if this application is MFC based, load the MFC module */ /* Then if this application is MFC based, load the MFC module */
/* FIXME: I'm not sure this is really necessary */ /* FIXME: I'm not sure this is really necessary */
@ -3333,8 +3334,8 @@ int WINAPI main(int argc, char** argv, char** envp)
if (hMFC!=NULL) { if (hMFC!=NULL) {
FreeLibrary(hMFC); FreeLibrary(hMFC);
} }
dlclose(appLibrary); /*dlclose(appLibrary);*/
free(libName); /*free(libName);*/
return retcode; return retcode;
} }