Thanks Andrew for your response
I would try and get back to you
Yes the code has below block
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
The source is C code with .C extension am adding /TP to MSFT:_*_*_CC_FLAGS
to overcome the variable declarations anywhere in the function
the same /TP does not throw any error with EDK I inf format of
[nmake.common]
C_STD_PROJ_FLAGS =
On Fri, Jun 7, 2013 at 9:41 PM, Andrew Fish <[email protected]> wrote:
> Sorry I did not realize that /TP was C++ as your original post mentioned a
> C file.
>
> If you are using edk2 libraries then you need to link against an entry
> point lib that will contain _ModuleEntryPoint. There will be a lib function
> that is generated in the AutoGen.c file that will contain a call to
> InitalizeOptionROM.
>
>
> Andrew Fish
>
>
> On Jun 7, 2013, at 8:45 AM, ranga rao <[email protected]> wrote:
>
> Thanks Andrew!
>
> As the error is coming from Entry point. How can i fix it's Prototype
>
> #if __UDK2010_BUILD__ && __EBCBUILD__
> EFI_STATUS EfiMain( IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable )
>
> #elif __UDK2010_BUILD__
> EFI_STATUS _ModuleEntryPoint ( IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable )
> #else
> EFI_STATUS InitializeOptionROM ( IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable )
>
> The /TP option is expecting a return value of "int" as cpp default return
> value for function is int
> Can i type-cast (or) try to fix the prototype
>
>
> Well 1st off you are missing EFIAPI that looks like it maps to __cdecl for
> your build...
>
> EFI_STATUS
> EFIAPI
> InitializeOptionRom (
> IN EFI_HANDLE ImageHandle,
> IN EFI_SYSTEM_TABLE *SystemTable
> )
>
> If you list an entry point in your INF file then it will have a prototype
> in the AutoGen.h file, so you can't change it. You will only get a
> prototype for _ModuleEntryPoint if you include
> <Library/UefiApplicationEntryPoint.h>
>
> So you could try changing it, assuming you are not using any library
> functions.
>
> I'm not sure how the compiler knows what the entry point of the function
> is? That seems like something the linker knows?
>
> Also if you are doing C++ you don't you need...
>
> #ifdef __cplusplus
> extern "C" {
> #endif
>
> #ifdef __cplusplus
> }
> #endif
>
> around you C includes.
>
> Does the compiler default to C++ if your file is named .cpp, that way you
> could mix C and C++ files together in your driver, but in different files?
>
>
> How can i do that?
>
> Appreciate your help
>
> I have lot of code where variables are declared inside the function,
> rather at the beginning of the function
> hence i had to use /TP with MSFT CL.exe
>
> Appreciate if any one has seen such similar error, Kindly respond
>
>
> On Fri, Jun 7, 2013 at 8:54 PM, Andrew Fish <[email protected]> wrote:
>
>> Fix the function prototype to the correct API. This is enforced in edk2
>> since your entry point is called from a library.
>>
>> You were just getting lucky it worked in the EDK.
>>
>> Sent from my iPhone
>>
>> On Jun 7, 2013, at 4:40 AM, ranga rao <[email protected]> wrote:
>>
>> Hi,
>> I have C source which I *have been* building using EDK 1.06.
>>
>>
>> The variables in the code are not declared in the beginning of the
>> function, and I could able to build the
>> Code with /TP flag
>>
>>
>> The same code is failing on EDK II(UDK2010.UP4)
>> When I attempted to build this using UDK 2010 UP4 with /TP flag, I see
>> the below error
>> Is throwing the below error at entry point
>> c:\udk2010.up1\MdeModulePkg\Bus\Pci\Sasdriver\Sasdriver.c(63) : error
>> C2440: 'in
>> itializing' : cannot convert from 'EFI_STATUS (__cdecl
>> *)(EFI_HANDLE,EFI_SYSTEM_
>> TABLE *)' to 'int'
>> How do I resolve this issue?
>> Appreciate the response!
>> Thanks
>> Ranga
>>
>>
>> --
>> Thanks
>> Ranga
>>
>>
>> ------------------------------------------------------------------------------
>> How ServiceNow helps IT people transform IT departments:
>> 1. A cloud service to automate IT design, transition and operations
>> 2. Dashboards that offer high-level views of enterprise services
>> 3. A single system of record for all IT processes
>> http://p.sf.net/sfu/servicenow-d2d-j
>>
>> _______________________________________________
>> edk2-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>
>>
>
>
> --
> Thanks
> Ranga
>
>
>
--
Thanks
Ranga
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel