Solved

Can anybody help me build a DLL ?

Posted on 2006-10-29
12
940 Views
Last Modified: 2012-05-05
Hi all

I am not a C++ developer. i am a Foxpro developer.

Can any one help me step by step on how to make a DLL from this open source project. There is a dll for  .net but not for C++ or VB6. Also there is a .XLL file for excel. Then i suppose it should be fairly be easy.

http://ta-lib.org/hdr_dw.html

I have Visual studio 6 installed.

Thanx in advance...


suhashegde
0
Comment
Question by:suhashegde
  • 9
  • 2
12 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 17828362
Zip file already contains ready for use library TA-Lib-Core.dll which can be find in ta-lib\dotnet\src\Release (Relaese configuration) and ta-lib\dotnet\src\Debug (Debug configuration). This is .NET library for C#/VB.NET clients. Is this what are you looking for?
There are also makefiles which build a lot of static libraries which should be used in C++ projects. How do you want to use this?
0
 
LVL 8

Author Comment

by:suhashegde
ID: 17831557
the TA-lib-core.dll is for use in .net I want a dll compiled in VC6 so that i can use in vfp6

CAn u help in posting a step by step way on how to make it into a VC6 DLL ? so that i can use in VFP ? (If the dll works in VB6 it will work in VFP6)

TIA
suhashegde
0
 
LVL 9

Assisted Solution

by:jhshukla
jhshukla earned 250 total points
ID: 17831946
Download the source code from ta-lib-0.2.0-src.zip OR ta-lib-0.2.0-src.tar.gz
There is a dsw project under ta-lib\c\ide\msvc\lib_proj.
Open the dsw file and build the entire project. I believe gen_code should be default project. It was for me on VS2003. Build failed on me with two linker errors
ta_regtest fatal error LNK1181: cannot open input file 'ta_libc_csr.lib'
gen_code fatal error LNK1181: cannot open input file 'ta_common_cmd.lib'
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 48

Accepted Solution

by:
AlexFM earned 250 total points
ID: 17832016
There are lot of makefiles in this project. You need to decide which one of them to build - readme files describe the meaning of these files. To build makefile do the following steps:
1) Open Visual Studio command prompt. This is done using menu item from Start - Programs - Visual Studio menu.
2) Using DOS commands like cd go to directory which contains makefile
3) Type command
nmake

I tried this with Release version of C library, it builds a lot of static libraries which can be used in VC++ projects.
0
 
LVL 8

Author Comment

by:suhashegde
ID: 17832077
ta-lib\c\make\cdr\win32\msvc make file -- that makes it into multithread dll  but how ?

As per the info i gathered , gen_code is some kind of a code generator to add to all the .net,java etc project files .


I dont want lib files but a DLL

TIA
suhashegde
0
 
LVL 8

Author Comment

by:suhashegde
ID: 17840300
Am i asking for too much ? Is it so difiicult.? I know nothing of VC++ so my apologies . I thought when there were export functions for Execl already there the building a dll would be easy ....

Thanx for your inputs

suhashegde
0
 
LVL 8

Author Comment

by:suhashegde
ID: 17840503
hi,

I did run nmake but didnt get a dll file , am i missing something ?
0
 
LVL 8

Author Comment

by:suhashegde
ID: 17903734
Is it possible to include the generated .lib files into a new workspace as a DLL and export the functions of the .lib ?

If so any pointers to the same ?

thanx

suhashegde
0
 
LVL 8

Author Comment

by:suhashegde
ID: 17905845
I have been caught with the 1 that requires parameter input

it is like this

TA_RetCode TA_S_AD( int startIdx,
int endIdx,
const float inHigh[],
const float inLow[],
const float inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] )

I put this in the .h file

class CMy_dllApp : public CWinApp
{
public:
int My_Ta_Initialize();
int My_Ta_Shutdown(void);
TA_RetCode My_TA_S_AD( int startIdx,
int endIdx,
const float inHigh[],
const float inLow[],
const float inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] );

CMy_dllApp();


and

in the .cpp

TA_RetCode CMy_dllApp::My_TA_S_AD( <== First line error points here
int startIdx,
int endIdx,
const float inHigh[],
const float inLow[],
const float inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] )
{

TA_RetCode retCode;

retCode = TA_S_AD(
int startIdx,
int endIdx,
const float inHigh[],
const float inLow[],
const float inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] )

return retCode;
}

Where the input parameters are the first 6 and the last 3 are output.
Return shows execution success or failure ..

I get compiler error saying

C:\WIN98\Desktop\ta-lib-0.2.0-msvc\ta-lib\my_dll\my_dll.cpp(94) : error C2144: syntax error : missing ')' before type 'int'
C:\WIN98\Desktop\ta-lib-0.2.0-msvc\ta-lib\my_dll\my_dll.cpp(94) : error C2660: 'TA_S_AD' : function does not take 0 parameters
C:\WIN98\Desktop\ta-lib-0.2.0-msvc\ta-lib\my_dll\my_dll.cpp(102) : error C2059: syntax error : ')'
Error executing cl.exe.

Please help me on doing this

suhashegde
0
 
LVL 8

Author Comment

by:suhashegde
ID: 17905861
sorry copy and paste error

TA_RetCode TA_S_AD( int startIdx,
int endIdx,
const float inHigh[],
const float inLow[],
const float inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] )

I put this in the .h file

class CMy_dllApp : public CWinApp
{
public:
int My_Ta_Initialize();
int My_Ta_Shutdown(void);
TA_RetCode My_TA_S_AD( int startIdx,
int endIdx,
const float inHigh[],
const float inLow[],
const float inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] );

CMy_dllApp();


and

in the .cpp

TA_RetCode CMy_dllApp::My_TA_S_AD(
int startIdx,
int endIdx,
const float inHigh[],
const float inLow[],
const float inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] )
{

TA_RetCode retCode;

retCode = TA_S_AD( <== First line error points here
int startIdx,
int endIdx,
const float inHigh[],
const float inLow[],
const float inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] );

return retCode;
}
0
 
LVL 8

Author Comment

by:suhashegde
ID: 17920216
.h file
TA_RetCode My_TA_AD( int startIdx,
int endIdx,
const double inHigh[],
const double inLow[],
const double inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[]);

.cpp file

TA_RetCode CMy_dllApp::My_TA_AD( int startIdx,
int endIdx,
const double inHigh[],
const double inLow[],
const double inClose[],
const int inVolume[],
int *outBegIdx,
int *outNbElement,
double outReal[] )

{


retCode = TA_AD( startIdx,
endIdx,
inHigh,
inLow,
inClose,
inVolume,
outBegIdx,
outNbElement,
outReal );

return retCode;
}

.Def
LIBRARY "my_dll"
DESCRIPTION 'my_dll Windows Dynamic Link Library'

EXPORTS
; Explicit exports can go here
My_Ta_Initialize @1
My_Ta_Shutdown @2
My_TA_S_AD @3
My_TA_AD @4


The dll builds fine with no errors.

When I call it in VFP like this

DECLARE Integer My_Ta_Initialize IN "c:\my_dll.dll"
My_Ta_Initialize()
clear dlls
DECLARE long My_TA_AD IN "c:\my_dll.dll" integer,;
integer,;
double @high1,;
double @low1,;
double @close1,;
double @vol1,;
integer @ret1,;
integer @ret2,;
double @RET3


?My_TA_AD(0,461,@high1,@low1,@close1,@vol1,@ret1,@ret2,@ret3)

where high1,low1,close1,ret3 are arrays
ret1 and ret2 are integers


Vfp throws Illegal operation error and shuts down

ANy light on the same where i am wrong
0
 
LVL 8

Author Comment

by:suhashegde
ID: 18062098
Although none of the comments were helpfull i split points between you two

i created a .fll from the same and works great

thanx you all for your help

suhashegde
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question