Solved

Can anybody help me build a DLL ?

Posted on 2006-10-29
12
933 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to understand recursion 12 218
Fast, free, private online code repository / editor 7 90
Which IDE to use to begin C++ training? 5 59
best sources to up-to-date in C++? 8 70
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now