|
-
Apr 27th, 2005, 01:37 PM
#1
Thread Starter
Junior Member
.dll question
I have a very big problem!
( i'm importing that dll!)
I have a c++(i think 6.0) .dll and .NET makes nothing!
In VB 6.0 it works great, but in VB .NET not!
So I import it with DLLImport but it do everything well,
but at finish the arraylength is only 1 and the result is a integer, that is nowhere in the dll!
So i think .Net can't really find the Entrypoint or can't interprete it!
I import it as following:
VB Code:
<DllImport("C:\VB_SchockKurve.dll", EntryPoint:="CalculateSchockDaten", CallingConvention:=CallingConvention.ThisCall, CharSet:=CharSet.None, SetLastError:=True, ExactSpelling:=True)> _
Public Shared Function CalculateSchockDaten(ByRef arr1() As Long, ByRef arr2() As Single, ByRef arr3() As Single) As Long
and the result:
VB Code:
result = CalculateSchockDaten(array1, array2, array3)
the code is right and options of the function are the right too.
But where the problem? Can't .Net import c++ 6.0 dlls???
Can't it find the entrypoint(but there is no error, but probably it can jump to nothing!)?
I have anybody here an idea?
mfg trevex
PS sorry for bad english, i'm just a german pupil
-
Apr 27th, 2005, 02:32 PM
#2
Junior Member
Re: .dll question
The calling convention is incorrect (Thiscall is used for class methods, try StdCall!).
Can you give us the signature of your API function (CalculateSchockDaten) in C(++) ?
-
Apr 28th, 2005, 12:21 AM
#3
Thread Starter
Junior Member
Re: .dll question
StdCall makes Nothing, too. All variables that will be give to the function have after the work only a length of 1! and the var result is an very big integer!
I can look for the source.
The function is in the class CalculateSchock is that important?
-
Apr 28th, 2005, 05:24 AM
#4
Junior Member
Re: .dll question
We need to make sure that the your DllImport definition of CalculateSchockDaten matches the C/C++ declarationexactly .
For example, in the C/C++ declaration, the return type has to be __int64, since you used 'Long' as return type.
If there is only one datatype that doesn't match, you can have the strange behaviour that you described, and cause stack corruption.
How did you get the DllImport definition ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|