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:
  1. 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:
  1. 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