Click to See Complete Forum and Search --> : passing an int val from C dll to Vb
janet
May 18th, 2000, 02:25 PM
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
ckaminski
May 18th, 2000, 03:59 PM
In your VB declare for the function abc, declare it 'as long' instead of 'as int'.
Nick@digitronics
June 2nd, 2000, 12:57 PM
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.
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.
Nick@digitronics
June 7th, 2000, 12:17 PM
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.
Nick@digitronics
June 7th, 2000, 12:38 PM
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++
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.