|
-
May 11th, 2005, 09:02 AM
#1
Thread Starter
Member
Problems with functions from a DLL
Hi all:
I don't know if you has seen YACAS (Yet Another Computer Algebra System). It has a DLL with CAS functions and evaluation and I think it was created in Visual C++ 6.0.
I would like to use that DLL (that comes with a .h header file with the functions declared to use in C++) in Visual Basic.
I tryed to declare the functions like they are in the header file, but i get some errors and I don't know what do they mean.
For example, there is a function called "yacas_init" that is declared as follow (in the C++ header file):
Code:
YACASDLL_API void yacas_init();
I created a VB declaration for that function like:
VB Code:
Public Declare Sub YACAS_Init Lib "yacasdll.dll" Alias "yacas_init" ()
When I call the function from VB I get no errors 
But, I have another function declared as follow:
Code:
YACASDLL_API void yacas_eval(char* expression);
And I created a VB Declaration again for that function:
VB Code:
Public Declare Sub YACAS_Evaluation Lib "yacasdll.dll" Alias "yacas_eval" (ByRef strExpression As String)
When I call that function from VB i get the following error:
"Bad DLL calling convention (Error 49)"
http://msdn.microsoft.com/library/de...allingConv.asp
I looked for many ways to solve the problem, changed ByRef to ByVal, changing String to another data type, etc.
Please help me with my problem.
Keep in touch,
Andy
-
May 11th, 2005, 09:41 AM
#2
Re: Problems with functions from a DLL
Have you tried changing String to Any or Variant? I know you said you tried other data types, but didnt say which ones.
-
May 11th, 2005, 10:45 AM
#3
Re: Problems with functions from a DLL
The String it's ByVal NOT ByRef, even though you use it to return data.
VB Code:
Public Declare Sub YACAS_Evaluation Lib "yacasdll.dll" Alias "yacas_eval" ([b]ByVal[/b] strExpression As String)
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
|