Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Lua µ÷ÓÃCдµÄ¶¯Ì¬¿âÓöµ½µÄÎÊÌâ¼°½â¾ö

 ×î½üÒ»¸öÏîÄ¿ÓÃlua5.1.4ºÍc++ÁªºÏ¿ª·¢¡£ÔÚ¿ª·¢µÄ¿ªÊ¼½×¶ÎÓöµ½ÁËÒ»µãÎÊÌ⣬ÎÊÌâÈçÏ£º
ÓÃÃüÁîÐÐÔËÐУºlua test.lua
lua: error loading modules 'dllforlua' from file './dllforlua.dll':
    ÕÒ²»µ½Ö¸¶¨µÄ³ÌÐò¡£
ÒòΪÊǵÚÒ»´ÎʹÓã¬Õâ¸öÎÊÌâÀ§ÈÅÁËÎҺü¸Ìì¡£¾­¹ý¶à·¬²âÊÔ£¬·¢ÏÖÈçϹæÂÉ£º
Èç¹ûÓÃrequireµ÷ÓõÄʱºò£¬C¶¯Ì¬¿âµÄÎļþÃû±ØÐëÒªÓëµ¼³öº¯Êý±£³ÖÒ»Ö¡£
ÀýÈ磺¶¯Ì¬¿âÃû×Ö£ºtestlua.dll£¬ÄÇôµ¼³öº¯Êý±ØÐëÈçÏ£º
extern "C"
LUALIB_API int luaopen_testlua(lua_State *L) {
 lua_register(L, "average", lua_average);
 return 0;
}
ÁíÍâÒ»ÖÖ½â¾ö·½·¨£¬ÓÃpackage.loadlib£¨¾ø¶Ô·¾¶.dll, "µ¼³öº¯ÊýÃû")
È»ºóµ÷ÓÃÕâ¸öµ¼³öº¯Êý
dllentry = package.loadlib("D:\\myprogram\\Lua\\firstC\\Release\\luatest.dll", "luaopen_suibian")
dllentry()
avg, sum = average(10, 20, 30, 40, 50)
print("The average is ", avg)
print("The sum is ", sum)
˵Ã÷£ºluatest.dllÊǶ¯Ì¬¿âµÄÃû×Ö£¬luaopen_suibianÊǵ¼³öº¯ÊýÃû£¬2Õß¿ÉÒÔ²»Ò»Ö¡£
½¨ÒéÓõÚÒ»ÖÖ·½Ê½¡£


Ïà¹ØÎĵµ£º

´ÓÁ½µÀ¾­µäÊÔÌâ̸C/C++ÖÐÁªºÏÌ壨union£©µÄʹÓÃ


´ÓÁ½µÀ¾­µäÊÔÌâ̸C/C++ÖÐÁªºÏÌ壨union£©µÄʹÓÃ
ÊÔÌâÒ»£º±àдһ¶Î³ÌÐòÅжÏϵͳÖеÄCPUÊÇLittle endian»¹ÊÇBig endianģʽ£¿
·ÖÎö£º
×÷Ϊһ¸ö¼ÆËã»úÏà¹ØרҵµÄÈË£¬ÎÒÃÇÓ¦¸ÃÔÚ¼ÆËã»ú×é³ÉÖж¼Ñ§Ï°¹ýʲô½ÐLittle endianºÍBig endian¡£Little endianºÍBig endianÊÇCPU´æ·ÅÊý¾ÝµÄÁ½ÖÖ²»Í¬Ë³Ðò¡£¶ÔÓÚÕûÐÍ¡¢³¤ÕûÐ͵ÈÊý¾ÝÀàÐÍ£ ......

pku 2115 C Looooops ͬÓඨÀí

 #include <stdio.h>
long long mod(long long a,long long b)
{
return (a % b + b) % b;
}

struct triple
{
long long d,x,y;
};

long long Euclid(long long a,long long b)
{
if(b == 0)
return a;
else
retu ......

C/C++ÖеÄÈÕÆÚºÍʱ¼ä time_tÓëstruct tmת»»

 ÕªÒª£º
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch ......

C/C++ÎÊ´ð(3)£º¹ØÓÚ¹¹ÔìºÍÎö¹¹º¯ÊýʹÓöà̬

ÎÊ£º
ÔÚ¹¹Ôì»òÎö¹¹ÆÚ¼äÄÜʹÓÃÐ麯ÊýÂð£¿
´ð£º
ÄÜ£¬µ«×îºÃ²»ÒªÕâô×ö¡£
Ç°Á½ÌìÔÚ¹«Ë¾ÓÎÏ·ÏîÄ¿¿ª·¢¹ý³ÌÖУ¬ÔÚÎö¹¹º¯ÊýÖв»Ð¡Ðĵ÷ÓÃÁËÐ麯Êý£¬¶øÇÒ»¹ÊǸö´¿Ð麯Êý¡£
ÒòΪһֱÊÇÔÚRleaseģʽϹ¤×÷µÄ£¬µ¼ÖÂϵͳֱ½ÓÖÕÖ¹¿Í»§¶Ë£¬ËäÈ»¿ØÖÆ̨ÓдòÓ¡Õâ¸ö´íÎ󣬵«ÖÕֹ̫¿ì£¬Ò²Ã»¿´µ½¡£Çл»ÔÚDebugϵ÷ÊÔ£¬Ôò»á±¨R6025 -pure vir ......

c vaϵÁкêµÄ»ù±¾Ó÷¨

 vaϵÁкêµÄÓ÷¨µÄÒ»°ã²½Ö裺
 vsptr(char *format, ...)  //ÇмǴ˴¦µÄ¸ñʽ
 {
    va_list argptr;
    va_start(argptr, format); //ʹµÃargptrÖ¸ÏòÒÔformat¿ªÍ·µÄ´æ´¢¿Õ¼ä
    va_arg(argptr, type);  //È¡´«µÝµÄ²ÎÊý
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ