linking.
/* main.c */#include
Add/add. h
/* add.h */#ifndef __ADD_H__#define __ADD_H__extern int add_int(int a, int b);extern float add_float(float a, float b);#endif
Add/add_int.c
/* add_int.c */int add_int(int a, int b){return a+b;}
Add/add_float.c
/* add_float.c */float add_float(float a, float b){return a+b;}
Sub directory.
Based on the code in the book, convert the c file to the target file and link it to it. If the header file cannot be found during main. c compilation, you must add "-I
) {return a+b;}Sub directory slightly.According to the code in the book, the C file is converted to the target file and then linked. Where, if in the compilation of Main.c, because the header files can not be found, so must be added to-iadd and-isub to be able to find, the book example is wrong.As you can see, compiling a small project requires so many steps:Gcc-o add/add_int.o-c add/add_int.c gcc-o add/add_float.o-c add/add_float.c gcc-o sub/sub_floa
project type is MFC Appwizard (exe)
Add the following in stdafx. h:
# Import "addcom. TLB" using namespace addcom;Program code:
Void cusecomdlg: onbuttonuse () {// todo: add your control notification handler code here int dresult; float fresult; cstring strresult; coinitialize (null ); // if the value of null is 0, addcom: addcominterfaceptr p_add (_ uuidof (addcomservice); dresult = p_add-> iadd (1.2); fresult = p_add-> FADD, 2.3); strresult. format ("int: % d/nfloat: % F", dresult, fresult);
: % d \ nfloat: % F", dresult, fresult );MessageBox (strresult, "calculation result", mb_ OK );
Couninitialize ();}
3. Compile COM components in vc6.0 and use vs2005 C # To call
(1) Write COM in vc6.0
Use vc6.0 to create a COM component. Project type: atl com Appwizard
Program code:
Interface:
Interface iadd: idispatch{[ID (1), helpstring ("method iadd")] hresult iadd ([in] int A, [in] int B, [out] int * C );[ID (2), helpstring ("method FADD")] hresult FADD ([in] float a, [in] float
Before declaring the class in the header file XXX. H, define the following content:
Struct mydata{Clistctrl * listctrl; // declare the objectInt isub;Int seq; // determines whether the sequence is ascending or descending.};
// Callback function
Inline int callback comparefuncs (lparam lparam1, lparam lparam2, lparam lparamsort){Mydata * P = (mydata *) lparamsort;Clistctrl * List = p-> listctrl;Int isub = p-
Copy codeThe Code is as follows: # include # Include
Void FindFile (char *, char *);Int count = 0; // number of statistical filesChar fname [32];# Define BUFSIZE 256Int main (int argc, char * argv []){Char szLogicalDriveStrings [BUFSIZE];DWORD iLength;Int iSub;Printf ("enter the name of the file to be searched :");Scanf ("% s", fname );ZeroMemory (szLogicalDriveStrings, BUFSIZE );ILength = GetLogicalDriveStringsA (BUFSIZE-1, szLogicalDriveStrings );F
for generating SUB_FLOAT.O sub_float.o:sub/sub_float.c sub/sub_float.hGCC-c-o SUB/SUB_FLOAT.O sub/sub_float.c# rules for generating MAIN.O main.o:main.c add/add.h sub/Sub.hGCC-c-o MAIN.O Main.c-iadd-isub# Cleanup rules clean:RM-F Test add_int.o add_float.o sub_int.o sub_float.o main.orules of Makefile:The makefile framework is made up ofRule Composition, when the make command executes, it first looks for various rules in the makefile file and then ru
: int i = 0;15 goto//Jump-to-loop condition check//This is the start of the body of the A for LOOP18 aload_0 Push the object ref at LOC var 0 (the This ref)//Pop object ref, push ref to instance variable IntArray19 GetField #4 arraylength//POP array ref, push int array length23 iconst_1/push Constant int 124 Isub//Pop II INTs, subtract, push int result25 iload 4//push int at local var 4 (i) 27
The following is the code that implements the string substitution function in the C language:
Char *replace (char *source, Char *sub, char *rep){Char *result;/*PC1 is the scan pointer copied to result results./*PC2 is the auxiliary pointer to scan source./*PC3 looking for substrings, check to see if the change source is equal to the substring and is the scan pointer to the sub./* Find the match, in order to copy to the result string, is pointing to the rep scan pointer.Char *PC1, *PC2, *PC3;int
Int[]{1, 2, 3, 4, 5}; int f = e[10]; System.out.println (f); } catch (ArrayIndexOutOfBoundsException var3) { var3.printstacktrace (); } Timer + = System.currenttimemillis (); }}By looking at the bytecode structure you know, first we need to add a field to the time class. Then in addition to the constructor the method injects the timing logic of the bytecode. Let's take the first Method Mycount () as an example, and use the JAVAP tool to v
interface can not have the subject, can only declare, no definition;(5.3) A class can implement multiple interfaces, must be separated by commas;Class name implements interface 1, interface 2{}(5.4) The interface can have attributes, but must be constant, and is public;Interface iusb{ Const A = 90;} echo "OK". Isub::a;class B implements iusb{public function aaa () { isub::a }} (5.5) interf
specific operation on the values on the two operand stacks, and restore the results to the top of the Operation stack.1) Addition command: iadd, ladd, fadd, dadd2) subtraction commands: isub, lsub, fsub, and dsub3) multiplication command: imul, lmul, fmul, dmul4) division command: idiv, ldiv, fdiv, ddiv5) remainder command: irem, lrem, frem, drem6) reverse command: ineg, leng, fneg, dneg7) Displacement command: ishl, ishr, iushr, lshl, lshr, lushr8)
instructions, such as Iload_
Operation InstructionThe arithmetic instruction is used to perform a specific operation on the values on the two operand stacks and to store the results back to the top of the Operation Stack.
1) Addition instruction: Iadd,ladd,fadd,dadd
2) Subtraction Instruction: Isub,lsub,fsub,dsub
3) Multiplication instruction: Imul,lmul,fmul,dmul
4 Division Instruction: Idiv,ldiv,fdiv,ddiv
5) The remainder instruction: Irem,lrem,fre
value from the operand stack to a local variable table: istore, Istore_Load a constant into the operand stack: Bipush, Sipush, LDC .....An instruction to expand the access index of a local variable table: wide.3 Operational InstructionsAn operation or arithmetic instruction is used to perform a specific operation on the values on the two operand stacks and to re-deposit the results to the top of the Operation Stack. Because there is no direct support for Byte,short, chart and Boolean arithmetic
directly support byte, short, Char, and Boolean types, the operation of this type of data should be replaced by an instruction that operates int. The arithmetic instructions for integers and floating-point numbers have their own different behavior when they overflow and are removed by 0, all the arithmetic instructions are as follows:
Addition instruction: Iadd,ladd,fadd,dadd
Subtraction instruction: Isub,lsub,fsub,dsub
Multiplicatio
(...)Is_ (A, b)--Same as a is B.Is_not (...)Is_not (A, b)--same as a is not B.Isub (...)Isub (A, b)--same as a-= B.Itruediv (...)Itruediv (A, b)--Same as a/= B when __future__.division are in effect.Ixor (...)Ixor (A, b)--Same as a ^= B.Le (...)Le (A, b)--Same as aLShift (...)LShift (A, b)--Same as a Lt (...)Lt (A, B)--Same as aMoD (...)MoD (A, b)--same as a% B.Mul(...) Mul(A, B)--Same as a * b.NE (...)NE (A, b)--Same as a!=b.Neg (...)Neg (a)--same a
convenient calls.
Dim topcodeSub cntop ()Topcode = "the current time is :"Topcode = topcode now ()End subDim leftcode, ISub cnleft ()For I = 1 to 5Leftcode = leftcode "NextEnd subDim rightcodeSub cnright ()For I = 1 to 9Rightcode = rightcode "NextEnd sub%>
5. Finally, call the template code in the database to convert special strings.
SQL = "select * From moban where m_id = 1"Set rs = server. Createobject
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.