/*
dll file must using same folder's dll,
X:/xx/xxx/my_dll.dll
O:/ooo/oo/my_dll.dll
my_dll.dll =content= mydll.dll
but loading to memory , it's two different dll.
*/
/* below is dll key function and compiler option */
/*
compiler option : Enable microsoft extension , calling conv: __cdecl
*/
#pragma data_seg(".shared")
int share_var_k = 0;
#pragma data_seg()
#pragma comment(linker, "/section:.shared,RWS")
DLLAPI int WINAPI get_share_var(void)
{
return share_var_k;
}
DLLAPI void WINAPI set_share_var(int value)
{
share_var_k = value;
}
/* ---- cut ---- */
/* -------------- below is test file function ------*/
int main(int argc, char *argv[])
{
printf("Hello, world!\n");
for(int i=0;i<25 br="" i=""> {
int value=0;
set_share_var(i);
Sleep(1000);
value = get_share_var();
printf("%d\r\n",value);
}
return 0;25>
2014年10月26日 星期日
2014年10月18日 星期六
lcc-win32 build openeuolua
build a openeuolua.dll for
work for LFW LuaForWindows_v5.1.4-46.exe (from goggle code)
in OpenEUOLua.zip OpenEUOLua.txt copy rename to --> openeuolua.c
; make an lib for lcc-win32 usage
copy X:\lua\5.1\lib\lua51.lib
pedump /EXP lua51.lib > 51.exp
buildlib 51.exp lua51_lcc.lib
makefile
[code]
SRCDIR=e:\lcc\p\openeuolua
CFLAGS=-I"E:\lcc\p\OpenEUOLua\lua51\include" -I"e:\lcc\include" -DWIN32 -DLUA_BUILD_AS_DLL
CC=$(LCCROOT)\bin\lcc.exe
LINKER=$(LCCROOT)\bin\lcclnk.exe
OBJS=\
openeuolua.obj
LIBS=e:\lcc\p\openeuolua\lua51_lcc.lib
EXE=e:\lua\5.1\clibs\openeuolua.dll
$(EXE): $(OBJS) Makefile
$(LINKER) -s -dll -entry DllMain -nounderscores -o e:\lua\5.1\clibs\openeuolua.dll $(OBJS) $(LIBS)
# Build openeuolua.c
OPENEUOLUA_C=\
$(SRCDIR)\lua51\include\lauxlib.h\
$(SRCDIR)\lua51\include\lua.h\
$(SRCDIR)\lua51\include\luaconf.h\
openeuolua.obj: $(OPENEUOLUA_C) $(SRCDIR)\openeuolua.c
$(CC) -c $(CFLAGS) $(SRCDIR)\openeuolua.c
link:
$(LINKER) -s -dll -entry DllMain -nounderscores -o e:\lua\5.1\clibs\openeuolua.dll $(OBJS) $(LIBS)
clean:
del $(OBJS) openeuolua.dll
[/code]
build lua dll module in mingw/msys
1. install mingw/msys , base_mingw,base_msys,g++
2. postinstall msys
3. download & build lua 5.1.5
make mingw
4. write a dll4lua.c
gcc -O2 -c -o dll4lua.o dll4lua.c
gcc -O -shared -o dll4lua.dll dll4lua.o -llua
2. postinstall msys
3. download & build lua 5.1.5
make mingw
4. write a dll4lua.c
gcc -O2 -c -o dll4lua.o dll4lua.c
gcc -O -shared -o dll4lua.dll dll4lua.o -llua
訂閱:
文章 (Atom)
常用 氧化活性 排行
氧化 化學反應 由高至低: 鉀鈉鋇鍶鈣鎂鋁碳鋅鉻鐵鈷鎳錫鉛氫銅汞銀鉑金
-
在 ~/.bash_rc 內加入以下 function 即可在新開的 terminal 中, 用 .. N 快速切換到祖先目錄. FYI: cd - 可以來回切換前後目錄. toN() # toN num default { test ${1} || retur...
-
### Installing Python 3.8 on Ubuntu 18.04 from Source ### $ sudo apt update $ sudo apt install build-essential zlib1g-dev libncurses5-dev li...
-
台灣 2025年 前3季行人 死亡數 比去年同期 增4% . 為宣傳政蹟, 搏版面, 過度強調 行人帝王條款 , 不知 很多人 都只聽 權利 , 而 忽略 馬路如虎口 , 身體是自己的 , 不要以身犯險 .