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

ÔÚvc.netÖеÄC/C++´úÂëÉú³ÉDLL²½Öè


1 Ñ¡Ôñnew->project->win32 console project£»
    ÔÚÕâÒ»²½µÄÑ¡¿òÉÏÓÐÒ»¸öÑ¡ÏîÊÇ create dictionary for solution, ÎÒ²»ÖªµÀÕâ¸ö¾ßÌåÊÇʲô×÷Óã¬Ñ¡ÁËÖ®ºó»áÏîÄ¿³öÏÖÁ½²ãÎļþ¼Ð£¬±ÈÈçÄã´´½¨Ò»¸öÃüÃûΪtestµÄÏîÄ¿£¬»áÉú³ÉtestÎļþ¼Ð£¬testÖаüº¬ÁíÒ»¸ötestÎļþ¼Ð£¬ÄãµÄÏîĿʵ¼ÊÉÏ·ÅÔÚÁËÄÚ²ãtestÎļþ¼ÐÖС£Ñ¡Ó벻ѡ¶ÔÓÚºóÐøµÄ´´½¨Ã»ÓÐÓ°Ïì¡£Õâ¸öµÄ¾ßÌå×÷ÓõÈÎÒ²éÃ÷°×ÁËÔÙ²¹ÉÏ£¡
2 ÊäÈëÄãµÄÎļþÃû×Ö->°´ÏÂnext->Ñ¡ÔñDLL->Ñ¡ÔñOK£»
3 ÔÚ¹¤³ÌÖÐÌí¼ÓÒ»¸öÓ빤³ÌÃû×ÖͬÃûµÄtest.hÎļþ£¬ÔÚÎļþÖÐдÈë´úÂ룺 extern "C" __declspec(dllexport) void testexam(char *input); £¨ÎļþÃû×ÖÊÇÐèÒªµ¼³öµÄÎļþÃû£©£»
4 ÔÚcppÎļþµÄÍ·ÉÏÆäËûincludeÓï¾äºóÃ棬Ìí¼Ó#include "test.h"£¬ÔÚÆäÖÐдÈëÄãµÄº¯Êývoid testexam(char *input);
5 ÔÚbuild->batch build Öн«Á½¸öÑ¡ÏѡÖУ¬È»ºóÑ¡ÔñÕâ¸öÑ¡Ïî¿òÖеıàÒëÖ¸Áî
OK, now you can get your dll and lib file in the release and debug file folder! Congratulations !


Ïà¹ØÎĵµ£º

ubuntuÏ£¬C/C++ͨ¹ýJNIµ÷Óà JAVAÀà

֮ǰд¹ýÒ»¸öʵÏÖÁËijÖÖ¹¦ÄܵÄjava³ÌÐò£¬µ«ÓÉÓÚ½üÈÕ“¹¤×÷”ÐèÒª£¬ÓÖÐèÒªÔÚc/c++ÖÐÖØÐÂʹÓøù¦ÄÜ¡£ÎªÁ˽Úʡʱ¼ä£¬ÎÒ²ÉÈ¡ÁËÔÚc/c++Öе÷ÓÃjava³ÌÐòµÄ·½·¨£¬µ«Ö®Ç°Ã»ÓнӴ¥¹ýÀàËƵĶ«Î÷£¬µ½ÍøÉÏÒ»²é£¬¹ûÈ»ÓÐÀàËƵĶ«Î÷£¬ÐÄÖаµÏ²ing...¡£²éµ½µÄ×ÊÁÏÖÐÓм¸¸ö²»´íµÄÍøÒ³£º
      &nbs ......

C/C++±ê×¼¿âʹÓÃ

ÊÕ¼¯ÁË¿´Ò»ÏÂC/C++±ê×¼¿âʹÓõÄÏà¹ØÍøÕ¾£º
GNU¹ÙÍø£º
http://www.gnu.org/
¸ÃÍøÕ¾°üº¬C/C++±ê×¼¿âµÄʹÓ÷¶Àý£¬ÖµµÃ²Î¿¼£º
http://www.cplusplus.com/
ÔÚǶÈëʽµÚÈý·½Èí¼þÒÆֲʱ£¬»áʹÓÃSTLÄ£°å¿â×÷ÏàÓ¦ÒÆÖ²£¬ÈçAndroidƽ̨JNI·â×°¼°ÒÆÖ²µÈ¡£
¸ÃÍøÕ¾½éÉÜstlportµÄʹÓã¬stlportÒѿɳɹ¦ÒÆÖ²ÖÁAndroidµÈǶÈëʽƽ̨£¬²¢Ç ......

JavaÓëCͨÐÅҪעÒâµÄ¼¸¸öÎÊÌâ

1.´óβ(big_endian)Сβ(little_endian)µÄÎÊÌâ
»ùÓÚWebµÄ²âÊÔÈí¼þÊÇÓÉC++Êý¾Ý²É¼¯·þÎñÆ÷³ÌÐòºÍ¿Í»§¶ËJavaÏÔʾ³ÌÐòÁ½²¿·Ö¹¹³É£¬Ç°ÕßÓÃC++£¬ºóÕßJavaÓïÑÔ£¬´æÔÚÊý¾ÝÒÆÖ²ÎÊÌâ¡£ÒòΪ
ÔÚ¼ÆËã»úϵͳÖУ¬µ±°üº¬Êý×ֵĶþ½øÖÆÎļþ´ÓÒ»¸ö½á¹¹ÒƵ½ÁíÒ»½á¹¹Ê±£¬¾Í³öÏÖ´óβСβÎÊÌâ¡£²»Í¬CPUÔÚ¶à×Ö½ÚÊý£¨ÈçËÄ×Ö½Úint£©´æ´¢Ê±ÓÐÁ½ÖÖ·½·¨ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ