|
-
May 18th, 2000, 02:25 PM
#1
passing an int val from C dll to Vb
Hi ,
currently , i am facing the problem of pass an int value from C Dll to a VB program.
my problem is ==>
when i pass an int value from C dll to vb , i am getting always zero val of that int in my Vb appln.
In Vb i have declared as :-
public declare funtion abc lib "c:\winnt\system32\mydll.dll" (byval myint as long) as integer
while in my Vb program i am calling this function as
return= abc(myint)
can you tell me what might be the problem ...
thanks
-
May 18th, 2000, 03:59 PM
#2
Re: passing an int val from C dll to Vb
In your VB declare for the function abc, declare it 'as long' instead of 'as int'.
-
June 2nd, 2000, 12:57 PM
#3
Re: passing an int val from C dll to Vb
how did you get the dll to work with your vb app. i have a win32 dll and i cannot get it to work with vb. it always say that it could not find the entry point into the dll.
-
June 6th, 2000, 01:40 PM
#4
Re: passing an int val from C dll to Vb
HI
make a file => mydllname.def
in that declare all your procedure names like this =>
EXPORTS proc_name @1 PRIVATE
In your mydllname.C file do this =>
int _stdcall proc_name()
{
}
this is working for me .. just try this .i think it will solve your problem.
-
June 7th, 2000, 12:17 PM
#5
Re: passing an int val from C dll to Vb
It cannot find the entry point because C++ is mangling the names in the DLL and you are declaring the functions by there regular names in VB. you can do 1 of 2 things. in your DLL code declare your functions with extern "C". This will cause you to remove the prototype definitions. or you can access the functions by ordinal number. the ordinals can be found by using the dumpbin utility that comes with VC. use the /EXPORTS parameter and give it the full path to your DLL. then in VB specify Alias "#n" where n is the ordinal number.
-
June 7th, 2000, 12:38 PM
#6
Re: passing an int val from C dll to Vb
Make sure your not mixing data types. A long in VB is the same as an INT in C++ and an INTEGER in VB is the same as a SHORT in C++
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
|