Compiling C Wrapper

Moderator: Moderator

Compiling C Wrapper

Postby jhouchin » Wed Nov 28, 2012 1:17 pm

I am attempting to compile the C wrapper.

According to the readme windows file, I installed the Windows 7 SDK.

Building the dll succeeded.

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:01.64

I am attempting to build the samples, but am getting this error.

C:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\samples\GetOffers>
fxbuild.bat

C:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\samples\GetOffers>call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat"
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
'vcbuild' is not recognized as an internal or external command,
operable program or batch file.

The Windows 7 SKD does not come with vcbuild.
The dll was built with msbuild.

Any help greatly appreciated.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas

Re: Compiling C Wrapper

Postby jhouchin » Thu Nov 29, 2012 11:30 am

Quick simple question. What prevents a compiled C wrapper from being included in the standard ForexConnect distribution or as a standalone installer for each release? Just curious.

People who want to access ForexConnect from other languages via FFI would probably find that a very nice convenience. Many like, might not have C/C++ compilers or experience with such. But our preferred language has means of interfacing the dll/so.

In fact, until I inquired about accessing via FFI, I didn't even know the C wrapper existed. I might have seen the C source in the distribution. But I know I didn't know it meant a C wrapper. It would be nice if this little jewel was documented as such on the wiki so people know it is available.

Thanks.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas

Re: Compiling C Wrapper

Postby Ekaterina » Fri Nov 30, 2012 2:43 am

Hi jhouchin,

There is some small issue with the C wrapper. To solve your problem, please find vcbuild script in the attachment. You should just put this file in the same folder where the sample is located and next to fxbuild.bat file.

According to your last questions:

Quick simple question. What prevents a compiled C wrapper from being included in the standard ForexConnect distribution or as a standalone installer for each release?


Perhaps it will be in the future!

I might have seen the C source in the distribution. But I know I didn't know it meant a C wrapper. It would be nice if this little jewel was documented as such on the wiki so people know it is available.


I think, that we will check our documentation for the improvements. Anyway you can find the whole list of available resources here: http://fxcodebase.com/wiki/index.php/Download

Bets regards,
Ekaterina
Attachments
vcbuild.rar
(268 Bytes) Downloaded 1006 times
Ekaterina
 

Re: Compiling C Wrapper

Postby jhouchin » Sun Dec 02, 2012 10:51 pm

Thanks for the script. I attempted it and I get these errors.

I started with a clean system with no MS dev tools. I installed the Windows 7 SDK and that is my only development tools in that chain. I am compiling from the Window 7.1 SDK command line.

Jimmie

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\ForexConnectAPI-C-sources-1.2.2>
cd samples\GetOffers

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>fxbuild.bat

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Comm
on7\Tools\vsvars32.bat"
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>REM Forming msbuild arguments string

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>SET project=GetOffers.vcproj

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>SHIFT

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>SET msbuildString="Release|Win32"

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>SET msbuildString=/p:Configuration="Release /p:platform=Win32"


c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>set msbuildString="GetOffers.vcproj /p:Configuration=Release /
p:platform=Win32"

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>echo Step 1: Upgrade
Step 1: Upgrade

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>call vcupgrade GetOffers.vcproj
Microsoft (R) Visual C++ Project Convert Utility - Version 10.00.30319
Copyright (C) Microsoft Corporation. All rights reserved.

Converting project file 'c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\ForexCo
nnectAPI-C-sources-1.2.2\samples\GetOffers\GetOffers.vcproj'.
Project file 'c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\ForexConnectAPI-C-
sources-1.2.2\samples\GetOffers\GetOffers.vcxproj' or filters file 'c:\Users\Jim
mie\ForexConnectAPI-C-sources-1.2.2\ForexConnectAPI-C-sources-1.2.2\samples\GetO
ffers\GetOffers.vcxproj.filters' already exist and will not attempt to overwrite
them.

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>echo Step 2: Build
Step 2: Build

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\
samples\GetOffers>call msbuild "GetOffers.vcproj /p:Configuration=Release /p:pla
tform=Win32"
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.17929]
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1009: Project file does not exist.
Switch: GetOffers.vcproj /p:Configuration=Release /p:platform=Win32
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas

Re: Compiling C Wrapper

Postby Ekaterina » Mon Dec 03, 2012 3:11 am

Hi jhouchin,

1. According to the error, during your last attempt to build a sample, the GetOffers.vcxproj.filters file has appeared :

Project file 'c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\ForexConnectAPI-C-
sources-1.2.2\samples\GetOffers\GetOffers.vcxproj' or filters file 'c:\Users\Jim
mie\ForexConnectAPI-C-sources-1.2.2\ForexConnectAPI-C-sources-1.2.2\samples\GetO
ffers\GetOffers.vcxproj.filters' already exist and will not attempt to overwrite
them.


You just need to delete this file and start a new build.

2. Please, use the new version of the script (see attachment), the previous one is a debug version.

Best regards,
Ekaterina
Attachments
vcbuild.rar
(366 Bytes) Downloaded 984 times
Ekaterina
 

Re: Compiling C Wrapper

Postby jhouchin » Mon Dec 03, 2012 12:44 pm

Thank you very much. You have been wonderful.

I reinstalled the sources so that I started clean.
I then copied your new script into the samples folders.
I built the wrapper, and the then the samples.

Everything seems fine. I get these warnings.

c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2>fxbuild.bat
...
Build succeeded.

"c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\ForexConnectC-vs2010.sln" (Bui
ld target) (1) ->
"c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\ForexConnectC.vcxproj" (defaul
t target) (2) ->
(ClCompile target) ->
source\cinterface.cpp(477): warning C4800: 'int' : forcing value to bool 'tru
e' or 'false' (performance warning) [c:\Users\Jimmie\ForexConnectAPI-C-sources-
1.2.2\ForexConnectC.vcxproj]
source\cinterface.cpp(662): warning C4800: 'int' : forcing value to bool 'tru
e' or 'false' (performance warning) [c:\Users\Jimmie\ForexConnectAPI-C-sources-
1.2.2\ForexConnectC.vcxproj]

2 Warning(s)
0 Error(s)

Time Elapsed 00:00:03.57


c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2>cd samples\GetOffers
...
Build succeeded.

"c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\samples\GetOffers\GetOffers.vc
xproj" (default target) (1) ->
(ClCompile target) ->
main.c(122): warning C4996: 'strdup': The POSIX name for this item is depreca
ted. Instead, use the ISO C++ conformant name: _strdup. See online help for det
ails. [c:\Users\Jimmie\ForexConnectAPI-C-sources-1.2.2\samples\GetOffers\GetOff
ers.vcxproj]
1 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.22


Also, I see this at the top
Targeting Windows 7 x86 Debug


How do I do a regular non-debug build? This is all new to me.

Thanks for all of your help.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas

Re: Compiling C Wrapper

Postby Ekaterina » Tue Dec 04, 2012 2:54 am

Hi jhouchin ,

As for the warnings, they are just standard one and do not have any influence. You can just ignore them.
For non-debug version you should run fxbuild.bat with the release option, like this: fxbuild.bat release.

Best regards,
Ekaterina
Ekaterina
 

Re: Compiling C Wrapper

Postby jhouchin » Tue Dec 04, 2012 6:55 pm

Thank you very much for all your help.

Jimmie
jhouchin
FXCodeBase: Confirmed User
 
Posts: 46
Joined: Fri Feb 25, 2011 1:38 pm
Location: Texas


Return to ForexConnect API

Who is online

Users browsing this forum: No registered users and 6 guests