Last active
August 15, 2016 23:02
-
-
Save retep998/a6047c6b03dfed5cc8a5d3e114316268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int bunny = 273; | |
int rabbit() { return 273; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> cl /c bar.c ; lib bar.obj ; cl /c foo.c ; link foo.obj bar.lib | |
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24213.1 for x64 | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
bar.c | |
Microsoft (R) Library Manager Version 14.00.24213.1 | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24213.1 for x64 | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
foo.c | |
Microsoft (R) Incremental Linker Version 14.00.24213.1 | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
foo.obj : error LNK2019: unresolved external symbol __imp_rabbit referenced in function main | |
foo.obj : error LNK2019: unresolved external symbol __imp_bunny referenced in function main | |
foo.exe : fatal error LNK1120: 2 unresolved externals |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
__declspec(dllimport) extern int bunny; | |
__declspec(dllimport) int rabbit(); | |
int main() { | |
printf("%d", bunny); | |
printf("%d", rabbit()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment