Calling DLL Functions under a namespace in RAD Studio - dll

I'm new to using RAD Studio as I currently have to use it for this current project. What I am trying to do is call functions defined in a DLL file which I generated in Visual Studio in a RAD Studio C++ project .
Following the advice from this question below
Using Visual Studio DLL in Embarcadero RAD Studio XE?
I have converted the C++ DLL file I have generated from Visual Studio to a supported file for RAD studio using their command:
mkexp pub-sub-sample.a pub-sub-sample.dll
I can verify that my functions have been exported as I did the command dump.
Turbo Dump Version 6.5.4.0 Copyright (c) 1988-2016 Embarcadero Technologies, Inc.
Display of File pub-sub-sample.dll
EXPORT ord:0001='?DisconnectCallback#PubSub#samples#awsiotsdk##IEAA?AW4ResponseCode#3#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V?$shared_ptr#VDisconnectCallbackContextData#awsiotsdk###6##Z'
EXPORT ord:0002='?GetCurrentPath#ConfigCommon#awsiotsdk##SA?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ'
EXPORT ord:0003='?InitializeCommon#ConfigCommon#awsiotsdk##SA?AW4ResponseCode#2#AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z'
EXPORT ord:0004='?InitializeTLS#PubSub#samples#awsiotsdk##IEAA?AW4ResponseCode#3#XZ'
EXPORT ord:0005='?LogParseError#ConfigCommon#awsiotsdk##KAXAEBW4ResponseCode#2#AEBV?$GenericDocument#U?$UTF8#D#rapidjson##V?$MemoryPoolAllocator#VCrtAllocator#rapidjson###2#VCrtAllocator#2##rapidjson##V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z'
EXPORT ord:0006='?ReconnectCallback#PubSub#samples#awsiotsdk##IEAA?AW4ResponseCode#3#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V?$shared_ptr#VReconnectCallbackContextData#awsiotsdk###6#W443##Z'
EXPORT ord:0007='?ResubscribeCallback#PubSub#samples#awsiotsdk##IEAA?AW4ResponseCode#3#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V?$shared_ptr#VResubscribeCallbackContextData#awsiotsdk###6#W443##Z'
EXPORT ord:0008='?RunPublish#PubSub#samples#awsiotsdk##IEAA?AW4ResponseCode#3#H#Z'
EXPORT ord:0009='?RunSample#PubSub#samples#awsiotsdk##QEAA?AW4ResponseCode#3#XZ'
EXPORT ord:0010='?Subscribe#PubSub#samples#awsiotsdk##IEAA?AW4ResponseCode#3#XZ'
EXPORT ord:0011='?SubscribeCallback#PubSub#samples#awsiotsdk##IEAA?AW4ResponseCode#3#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##0V?$shared_ptr#VSubscriptionHandlerContextData#mqtt#awsiotsdk###6##Z'
EXPORT ord:0012='?Unsubscribe#PubSub#samples#awsiotsdk##IEAA?AW4ResponseCode#3#XZ'
And also that it's building and running under a visual studio project where I can call the RunSample() function from the generated DLL file.
#include <iostream>
#include "PubSub.hpp"
int main()
{
awsiotsdk::samples::PubSub object1;
object1.RunSample();
}
My question is how can I port the example code above to run in a RAD studio C++ project? I tried using extern "C" __declspec(dllimport) in front of awsiotsdk::samples::PubSub object1 but it wasn't working.

Related

How to import the openjdk9 source code to visual studio 2017 after compilation in Windows 10l?

I tried to build the openjdk9 source code in Windows 10 by the following commands
go to D:\jdk9\jdk9 with cygwin
./configure -with-freetype=/cygdrive/c/freetype -enable-debug -with-target-bits=64
make all
Finally it build successfully with messages :
Creating support/demos/image/jfc/Font2DTest/Font2DTest.jar
Creating support/demos/image/jfc/Metalworks/Metalworks.jar
Creating support/demos/image/jfc/Notepad/Notepad.jar
Creating support/demos/image/jfc/TableExample/TableExample.jar
Creating support/demos/image/jfc/TransparentRuler/TransparentRuler.jar
Creating support/demos/image/jfc/SampleTree/SampleTree.jar
Creating jre jimage
Creating jdk jimage
WARNING: Using incubator modules: jdk.incubator.httpclient
WARNING: Using incubator modules: jdk.incubator.httpclient
Finished building target 'all' in configuration 'windows-x86_64-normal-server-fastdebug'
However how to import the project such as jdk or Hotspot to visual studio? There is neither no solution file nor project file generated, also there is no create.bat file exist in folder \jdk9\hotspot\make (openjdk 8 has the file), so how to import the jdk/Hotspot source code to the visual studio 2017 to debug the source code?
To build VS Project Creator run the following command from the openjdk9 top directory:
make hotspot-ide-project
In my case, the generated VS project files are located in:
.../openjdk9/build/windows-x86_64-normal-server-slowdebug/ide/hotspot-visualstudio
Finally, find the jvm.vcxproj file in the hotspot-visualstudio directory and open it.

MSBuildWorkspace.OpenSolutionAsync looking for targets in Visual Studio/v14.0

I have a VS 2013 console application that loads any solution(.sln) file - compiles all projects within it using Roslyn and extracts API usage information from the compilation model.
I am now facing this peculiar issue - When I run the application from within Visual Studio 2013 (using Ctrl-F5 or F5) everything works fine. I am able to compile stuff and extract all information.
However when I open a command line (cmd) and try to run this Console app from I get the following error:
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Impor
When I run
Note the v14.0 there. Why does MSBuildWorkspace try to look into v14.0 directory for required target files ? Is it because I installed the MSBuild tools for CTP and the default path while I run stuff from a simple command line has changed ?
--Edit--
Here is the import
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
However I doubt it is to do with the Import statement as such. If I run the console app .exe from the "Developer Command Prompt for Visual Studio 2013" everything works fine again.
You can make your Web Application projects self-contained and not require Visual Studio 2015 to compile by adding NuGet reference to MSBuild.Microsoft.VisualStudio.Web.targets.
I had this problem on my build server. When I targeted /tv:14.0 (Tool Version 14.0 which is the Roslyn Build engine)
I resolved it by going out to C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio then creating folders like v14.0\WebApplications
I then went out to my system with Microsoft.WebApplication.targets (because this is put out there by Visual Studio 2015) and copied that file out to the build servers new folder.

TypeScript 0.9.* VisualStudio TS5037: Cannot compile external modules unless the '--module' flag is provided

I do get the TypeScript compiler error TS5037: Cannot compile external modules unless the '--module' flag is provided.
I am using TypeScript 0.9.1.1 und Visual Studio 2012.
Where can I set the --module option in Visual Studio?
Web Essential seems to no longer support this option in the dialog.
Thankx, Harry
Update:
I have a configuration file (config.ts) for my project. This file contains many statements as the following:
export var loggedInUserId: number = 0;
There are no other statements as the one before. Do I have to define a class or module around it?
I was having this problem in Visual Studio 2013, even with that setting above set correctly. It turns out there's a project-level setting as well. If you go to Project Settings on the project with TypeScript (highlight the project and type Alt+Enter), then go to the TypeScript Build tab, and select AMD under "Module System"
You can find the option for non project files here (Tools - options - Editor - TypeScript):
For my project based work I use grunt : https://github.com/basarat/grunt-ts

TFS Build 2010 CodeActivity: Cannot Load Assembly in XAML

I am attempting to add a custom “activitycode” to a TFS Build. I wrote this months ago and had it working on a now defunct test environment. I am attempting to resurrect the use of the code onto a new test platform, and am running into issues.
When I open my build.xaml, I receive the dreaded red-box of pain where my custom activity should be, stating “Assembly could not be loaded because of an error in the XAML.” In the ErrorList, I also have found “Could not find type '.DeploySSRSReportActivity' in assembly 'ReportingServicesDeploy'.”
I have confirmed that my DLL is checked into source control and that the build controller is pointing to it.
Peeking into the raw XAML, I see that the build.xaml file defines the assembly as
xmlns:rsd="clr-namespace:;assembly=ReportingServicesDeploy
The line where my custom activity (and where V.S. finds the error) is:
<rsd:DeploySSRSReportActivity CurrentBuild="[BuildDetail]"
SourcesDirectory="[SourcesDirectory]"
mtbwt:BuildTrackingParticipant.Importance="High"
xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client"
xmlns:mtvco="clr- namespace:Microsoft.TeamFoundation.VersionControl.Common;assembly=Microsoft.TeamFoundation.VersionControl.Common"
xmlns:ras="clr-namespace:ReportingServicesDeploy;assembly=ReportingServicesDeploy"
xmlns:rsd="clr-namespace:;assembly=ReportingServicesDeploy"
xmlns:sad="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
xmlns:sad1="clr-namespace:System.Activities.Debugger;assembly=System.Activities" />
The DLL is named ReportingServicesDeploy.dll. The namespace within the DLL is ReportingServicesDeploy, and the name of the activity class is DeploySSRSReportActivity.
Where is the linkage failing so that I am getting that error?
When your attempting to edit the xaml your doing this on your machine directly, tfs and sourcecontrol is not involved, the location on server for controller is where build agent will look for assemblies during the build and where VS will get them when opening build definition for config.
Your error possibly is coused by old version being used.
The assemblies must be available for visual studio on your machine - one option is to add them to GAC or to post in VS bin folders. Start new instance of studio afterwards
To intall into GAC run this from Visual Studio command line:
gacutil /i "Path\To\YourAssembly.dll"
To remove assembly run following from Visual Studio command line:
gacutil /u "YourAssembly"
For studio assemblies i believe this is the folder:
Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

How to create a Type Library of System32 dll?

I need to use msctf.dll(COM server for Text Service Framework).I used REGASM to create a tlb file.I am using .NET 4.0 and Visual studio 2012 .
Command:
REGASM c:windows/System32/msctf.dll \tlb:msctf.tlb
Error:
RegAsm : error RA0000 : Failed to load 'C:\Windows\System32\msctf.dll' because i
t is not a valid .NET assembly
finally i need to create a Interop library of msctf using tlbimp.exe and use it in C# text service .
Need to add environmental variable when using cmd
In case of VS2012 Native tools Command prompt then it will work straight away.