Here is my function in C++:
__declspec (dllexport) void CHARtoINT(char *input, int *output)
{
int length = strlen(input);
for (int i=0; i > length; i++)
{
output[i] = (int)input[i];
}
}
Now, this function works fine if I declare it as a regular function and call
it from C++, but I need it exported and call from VB.NET.
Here's how it looks under VB.NET:
Public Shared SubCHARtoINT(ByVal input as string, ByRef output() as Integer)
And this crashes. I think it's to do with my ByRef call, but I need this
inorder for the function to work.
Thanks,
JLW 3 2047
"JLW" <as***@someplace.com> wrote in message
news:ey*************@TK2MSFTNGP11.phx.gbl... Here is my function in C++:
__declspec (dllexport) void CHARtoINT(char *input, int *output) { int length = strlen(input);
for (int i=0; i > length; i++) { output[i] = (int)input[i]; } }
Now, this function works fine if I declare it as a regular function and
call it from C++, but I need it exported and call from VB.NET. Here's how it looks under VB.NET:
Public Shared SubCHARtoINT(ByVal input as string, ByRef output() as
Integer) And this crashes. I think it's to do with my ByRef call, but I need this inorder for the function to work.
Disclaimer: I am happy to remain ignorant about all flavors of VB.
You talks about VB.Net so we are talking about managed code, yes?
If so, why do you use the old C-style null-terminated array of bytes instead
of the System::String class. If you switch to using strings then your
managed C++ code and your VB.Net code can both that common class.
If you are not targeting managed code then I _think_ (but I wouldn't bet
money on it) that "strings" in VB are BSTRs.
Regards,
Will
I actually only discovered std::string last night, and fell insantly inlove
with them. It looks like .NET String class is derived from the C++ String
class. I will be switching my code over to that, and I will let ya know if
it works. Ohh, hopefully one day I will learn C++ good enough, but till
then, gotta stick with what I know, VB.
Thanks again William,
JLW
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:Oo**************@TK2MSFTNGP11.phx.gbl... "JLW" <as***@someplace.com> wrote in message news:ey*************@TK2MSFTNGP11.phx.gbl... Here is my function in C++:
__declspec (dllexport) void CHARtoINT(char *input, int *output) { int length = strlen(input);
for (int i=0; i > length; i++) { output[i] = (int)input[i]; } }
Now, this function works fine if I declare it as a regular function and call it from C++, but I need it exported and call from VB.NET. Here's how it looks under VB.NET:
Public Shared SubCHARtoINT(ByVal input as string, ByRef output() as Integer) And this crashes. I think it's to do with my ByRef call, but I need
this inorder for the function to work.
Disclaimer: I am happy to remain ignorant about all flavors of VB.
You talks about VB.Net so we are talking about managed code, yes?
If so, why do you use the old C-style null-terminated array of bytes
instead of the System::String class. If you switch to using strings then your managed C++ code and your VB.Net code can both that common class.
If you are not targeting managed code then I _think_ (but I wouldn't bet money on it) that "strings" in VB are BSTRs.
Regards, Will
Even just at the extremely fundamental level they are very different, .Net
strings are immutable and std::string is very much designed to be mutable.
Ronald Laeremans
Visual C++ team
"JLW" <as***@someplace.com> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl... I actually only discovered std::string last night, and fell insantly inlove with them. It looks like .NET String class is derived from the C++ String class. I will be switching my code over to that, and I will let ya know if it works. Ohh, hopefully one day I will learn C++ good enough, but till then, gotta stick with what I know, VB.
Thanks again William,
JLW
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message news:Oo**************@TK2MSFTNGP11.phx.gbl... "JLW" <as***@someplace.com> wrote in message news:ey*************@TK2MSFTNGP11.phx.gbl... > Here is my function in C++: > > __declspec (dllexport) void CHARtoINT(char *input, int *output) > { > int length = strlen(input); > > for (int i=0; i > length; i++) > { > output[i] = (int)input[i]; > } > } > > Now, this function works fine if I declare it as a regular function and call > it from C++, but I need it exported and call from VB.NET. > Here's how it looks under VB.NET: > > Public Shared SubCHARtoINT(ByVal input as string, ByRef output() as Integer) > > And this crashes. I think it's to do with my ByRef call, but I need this > inorder for the function to work.
Disclaimer: I am happy to remain ignorant about all flavors of VB.
You talks about VB.Net so we are talking about managed code, yes?
If so, why do you use the old C-style null-terminated array of bytes instead of the System::String class. If you switch to using strings then your managed C++ code and your VB.Net code can both that common class.
If you are not targeting managed code then I _think_ (but I wouldn't bet money on it) that "strings" in VB are BSTRs.
Regards, Will
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: seash |
last post by:
class xyz{
public void somefunction{
if(this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
m_varFolderPath = this.folderBrowserDialog1.SelectedPath;
m_varFolderPath += ...
|
by: _R |
last post by:
Given that VS2005 has made an effort to clean up the syntax of VC++
(in C++/CLI), is there any future plans to do away with function
protos, ala C#/VB? What are they needed for these days?
|
by: 42601551 |
last post by:
in Jeff Partch's thread
http://groups.google.com/group/microsoft.public.vc.language/browse_thread/thread/b9468ebbf7927da8/a901653d04ad774a%23a901653d04ad774a?sa=X&oi=groupsr&start=1&num=3
says a...
|
by: new |
last post by:
I have data for each week in a single table. I need to export this data to
a separate flat file for each week.
Any ideas?
DB2 SQL Query export to flat files as a function of data on each record
|
by: Notre Poubelle |
last post by:
Hello,
I have a strange situation where I'm trying to export a function in a class,
but it won't get exported. I actually have a couple of header and cpp files.
Each pair of header and cpp...
|
by: K B |
last post by:
I'm sorry to post OT here but I was hoping that someone could help me. I
use Visual Studio 2005 and suddenly my Find feature has completely
stopped working. When I select it, the screen flickers...
|
by: JHNielson |
last post by:
I have a somewhat simple question, but have been baffled by it for a while, and now I'm on a tight deadline - have to get it done within 24 hours.
I am trying to export a set of files to my hard...
|
by: Jeffrey Walton |
last post by:
Hi All,
Sorry about dropping thish on M.P.D.L.CSharp. There is no M.P.D.L.VC.
So I hope someone has come across the issue...
How does one export a function (not a class) in a managed Dll?
...
|
by: =?Utf-8?B?UGF0cmljayBXZXN0ZXJob2Zm?= |
last post by:
Hello,
I'm currently working on a small DLL that will be used as an extension to a
working application. It is required that the DLL has only one export named
"C16_DLLCALL". So I started creating...
|
by: Rajakumarrs |
last post by:
i am trying to retrieve exported function names from a dll ,using export directory .I can get a Export function (export by name)...i cant get function name(export only by ordinals)...give some logic...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |