mirror of
https://github.com/frida/tinycc
synced 2024-11-28 10:33:07 +03:00
536ed76d5a
Also, retain storage qualifiers in type_decl, in particular also for function pointers. This allows to get rid of this very early hack in decl() type.t |= (btype.t & VT_STATIC); /* Retain "static". */ which was to fix the case of int main() { static int (*foo)(); ... Also: - missing __declspec(dllimport) is an error now - except if the symbol is "_imp__symbol" - demonstrate export/import of data in the dll example (while 'extern' isn't strictly required with dllimport anymore) - new function 'patch_storage()' replaces 'weaken_symbol()' and 'apply_visibility()' - new function 'update_storage()' applies storage attributes to Elf symbols. - put_extern_sym/2 accepts new pseudo section SECTION_COMMON - add -Wl,-export-all-symbols as alias for -rdynamic - add -Wl,-subsystem=windows for mingw compatibility - redefinition of 'sym' error for initialized global data
21 lines
440 B
C
21 lines
440 B
C
//+---------------------------------------------------------------------------
|
|
//
|
|
// HELLO_DLL.C - Windows DLL example - main application part
|
|
//
|
|
|
|
#include <windows.h>
|
|
|
|
void hello_func (void);
|
|
__declspec(dllimport) extern const char *hello_data;
|
|
|
|
int WINAPI WinMain(
|
|
HINSTANCE hInstance,
|
|
HINSTANCE hPrevInstance,
|
|
LPSTR lpCmdLine,
|
|
int nCmdShow)
|
|
{
|
|
hello_data = "Hello World!";
|
|
hello_func();
|
|
return 0;
|
|
}
|