Commits

Jason McKesson committed 7756327 Merge

Merged in jrsimmons/glloadgen/kill_warnings_cptr (pull request #1)

Comments (0)

Files changed (1)

modules/StylePointerC.lua

 	return options.prefix .. "_ptrc_".. spec.FuncNamePrefix() .. func.name
 end
 
+local function GetFuncPtrType(hFile, func, typemap, spec, options)
+	return string.format("%s (%s *)(%s)",
+		common.GetFuncReturnType(func, typemap),
+		spec.GetCodegenPtrType(),
+		common.GetFuncParamList(func, typemap))
+end
+
 local function GetFuncPtrDef(hFile, func, typemap, spec, options)
 	return string.format("%s (%s *%s)(%s)",
 		common.GetFuncReturnType(func, typemap),
 end
 
 function my_style.source.WriteExtFuncLoader(hFile, func, typemap, spec, options)
-	hFile:fmt('%s = %s("%s%s");\n',
+	hFile:fmt('%s = (%s)%s("%s%s");\n',
 		GetFuncPtrName(func, spec, options),
+		GetFuncPtrType(hFile, func, typemap, spec, options),
 		common.GetProcAddressName(spec),
 		spec.FuncNamePrefix(), func.name)
 	hFile:fmt('if(!%s) numFailed++;\n', GetFuncPtrName(func, spec, options))
 end
 
 function my_style.source.WriteCoreFuncLoader(hFile, func, typemap, spec, options)
-	hFile:fmt('%s = %s("%s%s");\n',
+	hFile:fmt('%s = (%s)%s("%s%s");\n',
 		GetFuncPtrName(func, spec, options),
+		GetFuncPtrType(hFile, func, typemap, spec, options),
 		common.GetProcAddressName(spec),
 		spec.FuncNamePrefix(), func.name)