Need help with 2 linker errors

First /NODEFAULTLIB switch is on, /ENTRY:main is also set
Platform is Windows 7 x86 but will also target x64 as well plus needs to support Windows XP for time being.

Goal of app is to be injected into another app of user choice.

These are the last 2 errors I have left which I cannot find any useful information for
1
2
3
4
5
||=== Build: msw-x86-d-vc in hackProc (compiler: MSVC2013-x86) ===|
hackProc.obj||error LNK2019: unresolved external symbol __allshl referenced in function _hackProc|
main.obj||error LNK2019: unresolved external symbol __chkstk referenced in function _main|
C:\p\bin\medit\hackProc.exe||fatal error LNK1120: 2 unresolved externals|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


All code available at https://github.com/awsdert/medit/commit/e4842a2eb42cf34c56f7978620631a2ba0986521
Managed to resolve the issues, for those who have similar problems I'll explain what I learnt about these functions.

_chkstk() is for functions whose local data is greater than a page worth, in my case I was able to move the larger data to just before the function making it more permanent and thus removing the need for _chkstk() to be placed.

_allshl is part of a set of functions for working with long long data when native support is not available, in my case I could not avoid this requirement and copied the code from microsoft research site and mentioned it in a comment before the code like so:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifdef _WIN32
// Copied from microsoft research
__declspec(naked) void __cdecl _allshl(void)
{
    __asm {
// Handle shifts of 64 or more bits (all get 0)
        cmp     cl, 64
        jae     short RETZERO
// Handle shifts of between 0 and 31 bits
        cmp     cl, 32
        jae     short MORE32
        shld    edx,eax,cl
        shl     eax,cl
        ret
// Handle shifts of between 32 and 63 bits
MORE32:
        mov     edx,eax
        xor     eax,eax
        and     cl,31
        shl     edx,cl
        ret
// return 0 in edx:eax
RETZERO:
        xor     eax,eax
        xor     edx,edx
        ret
    }
}
#endif 

If I could've used other code for it I would but I suspect I would not have been able to find it, either way this at least prevents a conflict with microsofts own version
Topic archived. No new replies allowed.