Home > Software engineering >  Please put 2 VB function to VC code interface can't change
Please put 2 VB function to VC code interface can't change

Time:09-18

VB code, need to change to VC code for VB call DLL, remove simple key code, and the rest of the interface can't alter,

'binary print to print function stream file
Public Sub WriteEntry1 (ByRef BW As BinaryWriter, ByVal StartSample As UInt32, ByVal EndSample As UInt32, ByRef TextString As String)
BW. Write (StartSample)
BW. Write (EndSample)
Dim tStrLen As UInt32 'length including the end of the string 0
TStrLen=CUInt (TextString. Length + 1)
BW. Write (tStrLen)
For As the Integer=0 To x CInt (tStrLen - 2)
BW. Write (CByte (Asc (TextString. Chars (x))))
Next
BW. Write (CByte (0))
End Sub
'create a stream file and print
Public Sub DecodeCustom1 (ByVal OutFilename As String, ByVal NumberOfSamples As an Integer, ByVal RateIndex As Byte, ByVal Parameters As String)
'the stream file
Dim the FS As New FileStream (OutFilename, FileMode. Append, FileAccess. Write)
Dim BW As New BinaryWriter (FS)

Dim va As ULong test
'Dim STR As String
Va=100
STR="hello"
WriteEntry (BW, 3000, 3500, CStr (va))
WriteEntry (BW, 7000, 7500, STR)
End Sub

CodePudding user response:

Don't be A language code is modified to B language code busywork,
Also don't use A language code to directly invoke B language code base, this complicated things so easy to get wrong,
Just make A, B language code of input and output is redirected to A text file, or modify A, B language code let it through text file input and output,
Can easily make A, B coordination between the two languages,
For example:
A will request data written to A file a.t xt, renamed after finish aa. TXT
B find aa. TXT, read its contents, call the corresponding function, and writes the results file b.t xt, after finish delete aa. TXT, changed its name to bb. TXT
Found A bb. TXT, read the content, after finish delete bb. TXT
Above can be replaced by any kind of A language or development environment, B can be replaced by any kind of with the development of A different language or development environment,
Unless A or B does not support to determine whether A file exists, file read and write and file name,
But who can name does not support to determine whether a file exists, file read and write and file name for the development of language or development environment?
Can put the temporary files on the RamDisk efficiency decrease wear disk,
Data structure is very complex, a text file format problems refer to a json or XML

The communication methods between the temporary text file sharing this process there are plenty of advantages, compared to other method only listed below I can think of now:
Loose coupling between process,
Can be on the same machine, process, also can cross machine, across the operating system, hardware platform, and even multinational,
, convenient debugging, and monitoring, only let the third party or artificial view the temporary text files,
Switch, convenient online service, need to delete or create the temporary text files,
, is convenient to realize distributed and load balancing,
Services to provide convenient, queue, queue is full and it is almost impossible to happen (unless the hard disk space full)
DE...

"Across different languages, machine, across the operating system, hardware platform, multinational, cross *. *" misery,
Back is "the use of Shared a plain text file information communication" of the shore!

CodePudding user response:

323232324343

CodePudding user response:

refer to the second floor huangqi412 response:
323232324343

For more than a year haven't written?

CodePudding user response:

"Translation" from B language into the C language, should be very easy...


C/C + + operation "equipment", the code should be written very well...
However, since it is VB code, why did DLL, and to the use of C for VB again?
Feeling a bit "redundant"!

CodePudding user response:

The original is VB.NET...


Then using c # to do DLL, this should be "easier to translation",
  • Related