Closed micronpn closed 8 years ago
General portability problems? It's fairly portable code, but that doesn't necessarily mean that any odd target will work out of the box. That bit of code is the unix variant of memory protection modification - where it uses either the Unix or the Windows variant.
On what kind of operating system are you compiling it?
Il 12/01/2016 14:16, dascandy ha scritto:
General portability problems? It's fairly portable code, but that doesn't necessarily mean that any odd target will work out of the box. That bit of code is the unix variant of memory protection modification
- where it uses either the Unix or the Windows variant.
Portability means that you can build your application in several environments without any source code modification. At the moment I am trying to build HippoMocksTest (the test application you delivered) with GCC compilers (Windows and embedded compilers). For simplicity I put hippomocks.h and comsupport.h in the source code folder. But anyway it doesn't compile.
Using a bare metal g++ it compiles with errors.
Also compiling with MinGW compiles with errors.
On what kind of operating system are you compiling it?
Bare metal, arm-none-eabi-g++ is the C++ compiler used in embedded devices so without any OS or with limited RTOS as FreeRTOS and Keil RTX.
— Reply to this email directly or view it on GitHub https://github.com/dascandy/hippomocks/issues/48#issuecomment-170924075.
Questa e-mail è stata controllata per individuare virus con Avast antivirus. https://www.avast.com/antivirus
HippoMocks is intended to be used in a hosted environment, a typical development environment, where you would normally run your unit tests. You can adapt it to run on bare metal, but you would need to modify it to interact with your OS (or your bare metal logic) to modify write and/or execute permissions on memory pages. These are normally used to ensure no data is executed, and no code is modified.
HippoMocks, when used to do C function mocking, does modify code and therefore needs to be able to modify these bits. You can do that either with Windows API calls, with Unix API calls, or by adding it yourself. So far I haven't heard from anyone trying to do this without an underlying OS.
If your OS (barebones, or what it may be) has protection, you'll need to add a way to turn it off. That can either be with an existing API, or by adding a new one. If your OS has no protection (or no effective protection, ie, executable code is writable) then you can add a null modifier that does nothing when asked to unprotect.
Generally speaking seems to me that there are general portability problems in hippomock source code. It should be a great tool solving problems as this one.