2

Does anybody may give someone advice for me how realise DataStage connection?
API Link: https://www.ibm.com/docs/en/iis/11.3?topic=interfaces-infosphere-datastage-development-kit
I try include the api but when I run the program I get error: 0xc000007b
Where I made a mistake?
Thanks for anwer!

main.cpp

#include <iostream>
#include "dsapi.h"

int main() {
    DSSetServerParams("domain", "username", "password", "server");
    char* result = DSGetProjectList();
    if(result != NULL)
    {
        printf(result);
    }
    else
    {
        printf(DSGetLastError());
    }
    return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.15)
project(datastage_api)

set(CMAKE_CXX_STANDARD 17)

add_library(vmdsapi SHARED IMPORTED)
set_target_properties(
        vmdsapi
        PROPERTIES LINKER_LANGUAGE CXX COMPILE_FLAGS "-m32" LINK_FLAGS "-m32"
        IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/lib/vmdsapi.dll
        IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/lib/vmdsapi.lib)

add_library(ACS_client_cpp STATIC IMPORTED)
set_target_properties(
        ACS_client_cpp
        PROPERTIES LINKER_LANGUAGE CXX COMPILE_FLAGS "-m32" LINK_FLAGS "-m32"
        IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/lib/ACS_client_cpp.dll
)

add_library(ACS_common_cpp STATIC IMPORTED)
set_target_properties(
        ACS_common_cpp
        PROPERTIES LINKER_LANGUAGE CXX COMPILE_FLAGS "-m32" LINK_FLAGS "-m32"
        IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/lib/ACS_common_cpp.dll)

add_library(DSCLNT32 STATIC IMPORTED)
set_target_properties(
        DSCLNT32
        PROPERTIES LINKER_LANGUAGE CXX COMPILE_FLAGS "-m32" LINK_FLAGS "-m32"
        IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/lib/DSCLNT32.dll)

add_library(dsrpc32 STATIC IMPORTED)
set_target_properties(
        dsrpc32
        PROPERTIES LINKER_LANGUAGE CXX
        IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/lib/dsrpc32.dll)

add_library(invocation_cpp STATIC IMPORTED)
set_target_properties(
        invocation_cpp
        PROPERTIES LINKER_LANGUAGE CXX
        IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/lib/invocation_cpp.dll)

add_library(xmogrt STATIC IMPORTED)
set_target_properties(
        xmogrt
        PROPERTIES LINKER_LANGUAGE CXX
        IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/lib/xmogrt.dll)

include_directories(${PROJECT_SOURCE_DIR}/inc)
link_directories(${PROJECT_SOURCE_DIR}/lib)

add_executable(datastage_api main.cpp )
set_target_properties(datastage_api PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")

target_link_libraries (datastage_api vmdsapi ACS_client_cpp ACS_common_cpp DSCLNT32 dsrpc32 invocation_cpp xmogrt)

add_custom_command(
        TARGET datastage_api POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_if_different
        "${PROJECT_SOURCE_DIR}/lib/vmdsapi.dll"
        "$<TARGET_FILE_DIR:datastage_api>")

ProcessMonitor performance:
Trying to find x64 dll

enter image description here

Looks like that wow64.dll have not x32 analog. It is correct?
How have working plase this library?

enter image description here

Get error: 0xc000007b

After closing I catched thread exit with Exit Status: -1073741701

It is strange that in used modules not existed dll's from CMakeLists.txt Modules:

SFC.DLL
WINTRUST.dll
ntmarta.dll
GrooveIntlResource.d
UIRibbonRes.dll
7-zip.dll
fzshellext_64.dll
TortoiseOverlays.dll
cpwinet.dll
pkivalidator.dll
cpsspap.dll
cpschan.dll
cpadvai.dll
detoured.dll
cpcrypt.dll
Explorer.EXE
ntoskrnl.exe
UIRibbon.dll
DUI70.dll
ucrtbase.dll
msoshext.dll
prremote.dll
ieproxy.dll
werconcpl.dll
wscui.cpl
tiptsf.dll
ShellExImpl.dll
ShellEx.dll
zipfldr.dll
igfxDTCM.dll
WSCAPI.dll
wscinterop.dll
syncui.dll
framedynos.dll
DUser.dll
SyncCenter.dll
bthprops.cpl
srchadmin.dll
cscobj.dll
cscui.dll
EthernetMediaManager
SettingMonitor.dll
NetworkUXBroker.dll
pnidui.dll
PortableDeviceTypes.
wpdshserviceobj.dll
mssprxy.dll
AUDIOSES.DLL
wcmapi.dll
Actioncenter.dll
Syncreg.dll
SHDOCVW.dll
dxp.dll
prnfldr.dll
Windows.UI.Shell.dll
BatMeter.dll
stobject.dll
EhStorShell.dll
NetworkExplorer.dll
GROOVEEX.DLL
ieframe.dll
MSVCP140.dll
MLANG.dll
zlib1_tgit.dll
VCRUNTIME140.dll
VCRUNTIME140_1.dll
gitdll.dll
libgit2_tgit.dll
TortoiseGit.dll
TortoiseGitStub.dll
Windows.Internal.She:20
DDRAW.dll
d3d10_1core.dll
GLU32.dll
OPENGL32.dll
igfxLHM.dll
Windows.Networking.Slease.160715-1
DCIMAN32.dll
d3d10_1.dll
igfxDI.dll
igfxDH.dll
atlthunk.dll
Windows.Security.Aut0410)
wpnprv.dll
Windows.Networking.C42
NotificationObjFacto
wpnapps.dll
Windows.Web.dll
npsm.dll
AboveLockAppHost.dll
NotificationControll
ntshrui.dll
twinui.pcshell.dll
edputil.dll
thumbcache.dll
windows.immersiveshe28.04.20187:2
TwinUI.dll
explorerframe.dll
dataexchange.dll
OLEACC.dll
SndVolSSO.DLL
SharedStartModel.dll
settingsynccore.dll
wwapi.dll
AppVEntSubsystems64.
NotificationControll
settingsyncpolicy.dl
TWINAPI.dll
MSOXEV.DLL
wlidprov.dll
TokenBroker.dll
twinui.appcore.dll
execmodelproxy.dll
DAVHLPR.dll
ntlanman.dll
drprov.dll
WorkFoldersShell.dll
sfc_os.dll
twext.dll
OneCoreCommonProxySt
provsvc.dll
MsftEdit.dll
msiltcfg.dll
NInput.dll
InputSwitch.dll
Geolocation.dll
keepaliveprovider.dl
IDStore.dll
PhotoMetadataHandler
hgcpl.dll
dlnashext.dll
imapi2.dll
BiWinrt.dll
SYNCENG.dll
StructuredQuery.dll
Windows.Storage.Sear
deviceaccess.dll
Windows.Globalizatio
Windows.UI.Immersive
Windows.UI.dll
wincorlib.DLL
gdiplus.dll
ondemandconnroutehel
MPR.dll
msxml6.dll
MrmCoreR.dll
comctl32.dll
ActXPrxy.dll
MFPlat.DLL
WINBRAND.dll
RTWorkQ.DLL
cscapi.dll
StateRepository.Core
Windows.StateReposit
iertutil.dll
srvcli.dll
cdp.dll
urlmon.dll
WININET.dll
winsqlite3.dll
wpncore.dll
VERSION.dll
CHARTV.dll
DevDispItemProvider.
NETAPI32.dll
policymanager.dll
rmclient.dll
dsreg.dll
LocationFrameworkPS.
IconCodecService.dll
ShellExtensionX64.dl
d2d1.dll
SAMLIB.dll
MMDevApi.dll
igc64.dll
XmlLite.dll
npmproxy.dll
igd10iumd64.dll
es.dll
wlanapi.dll
UIAnimation.dll
DEVRTL.dll
d3d11.dll
usermgrcli.dll
wkscli.dll
wintypes.dll
CoreUIComponents.dll
windowscodecs.dll
PortableDeviceApi.dl
hcproviders.dll
wevtapi.dll
netprofm.dll
WMICLNT.dll
PROPSYS.dll
wer.dll
WINHTTP.dll
Secur32.dll
smartscreenps.dll
dhcpcsvc.DLL
dhcpcsvc6.DLL
CoreMessaging.dll
globinputhost.dll
dcomp.dll
MSOHEVI.DLL
MSWB7.dll
wtsapi32.dll
fwpuclnt.dll
Bcp47Langs.dll
WINNSI.DLL
dwmapi.dll
apphelp.dll
nlaapi.dll
sppc.dll
WINMMBASE.dll
SLC.dll
WINMM.dll
pcacli.dll
UxTheme.dll
twinapi.appcore.dll
msvcp110_win.dll
VEEventDispatcher.dl
resourcepolicyclient
DEVOBJ.dll
dxgi.dll
WLDP.DLL
DPAPI.DLL
schannel.DLL
rsaenh.dll
IPHLPAPI.DLL
DNSAPI.dll
netutils.dll
USERENV.dll
mswsock.dll
cpmsi.dll
msi.dll
cryptsp.dll
CRYPTBASE.dll
NTASN1.dll
ncrypt.dll
SspiCli.dll
EventAggregation.dll
sxs.dll
WINSTA.dll
bcrypt.dll
kernel.appcore.dll
profapi.dll
powrprof.dll
KERNELBASE.dll
bcryptPrimitives.dll
ucrtbase.dll
windows.storage.dll
CRYPT32.dll
shcore.dll
msvcp_win.dll
win32u.dll
gdi32full.dll
cfgmgr32.dll
combase.dll
shlwapi.dll
coml2.dll
MSCTF.dll
RPCRT4.dll
msvcrt.dll
ole32.dll
COMDLG32.dll
PSAPI.DLL
sechost.dll
WS2_32.dll
KERNEL32.DLL
IMM32.DLL
GDI32.dll
clbcatq.dll
SETUPAPI.dll
ADVAPI32.dll
NSI.dll
USER32.dll
SHELL32.dll
OLEAUT32.dll
ntdll.dll

Wolfgang
  • 109
  • 1
  • 10
  • 3
    Probably your app is 32-bit, but you're attempting to load a 64-bit module/DLL, or vice-versa (app is 64-bit, and you're attempting to load a 32-bit module/DLL). – PaulMcKenzie Jul 06 '21 at 16:36
  • @PaulMcKenzie I checked it. – Wolfgang Jul 07 '21 at 05:08
  • And how did you check this? If you have DLL's that have the same name, but found by the Windows DLL search algorithm, Windows will attempt to load the DLL, regardless of the type of application you will be running. If you're running a 32-bit app, but Windows finds a 64-bit DLL that matches that name, Windows will attempt to load it, and thus get the error. Same thing with 64-bit app and 32-bit DLL. [See this answer](https://stackoverflow.com/questions/28299246/0xc000007b-error). – PaulMcKenzie Jul 07 '21 at 07:14
  • Also, showing us your source code for the main program does not help in the issue. Your 32-bit program and 64-bit program will look exactly the same in terms of source code. The problem is a runtime issue, not a compiling issue. So is your program 32-bit or 64-bit? You haven't mentioned that at all. – PaulMcKenzie Jul 07 '21 at 07:17
  • @PaulMcKenzie I used dumpbin.exe /headers to dll and saw x86 header. In my CmakeLists.txt seted flags -m32 for libs and executable. I will try run the program at stantion with x32 windows tomorow. But I not shure that it will fix problem. Do you have other variants? – Wolfgang Jul 07 '21 at 14:26
  • 1
    Windows OS doesn't care what dumpbin has. Again, if a DLL's name matches what Windows finds at runtime, Windows will try to load that DLL. Windows doesn't skip over the DLL if it doesn't match the bit-ness of the application. That's what causes `0xc000007b` errors. [Here is a description of the DLL Search Order](https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order). – PaulMcKenzie Jul 07 '21 at 14:39
  • @PaulMcKenzie, How I can checking dll bits class? Do I have to start program on the 32-bit OS for resolve ? – Wolfgang Jul 07 '21 at 16:26
  • See the linked answer. You need to use a utility that shows what DLL is being loaded and where. – PaulMcKenzie Jul 07 '21 at 16:27
  • @PaulMcKenzie, Tell me, please, what the utility? – Wolfgang Jul 07 '21 at 16:41
  • 1
    [Process Monitor](https://learn.microsoft.com/en-us/sysinternals/downloads/procmon). Again, see the linked answer. I have never used the tool, but the answer that has 15 upvotes used it to diagnose the error. – PaulMcKenzie Jul 07 '21 at 16:46
  • @PaulMcKenzie Thanks! I come back later. – Wolfgang Jul 07 '21 at 16:49
  • @PaulMcKenzie Hello. Can you comment Exit Status: -1073741701 ? How can I identify bad dll? – Wolfgang Jul 08 '21 at 06:46
  • Your `C++` code seems legitimate. I can see that you are making a decision to go with the x86 (32-bit) development as thoroughly described in the `CMakeList.txt`. You might not be safe from a lurking x64 DLL here or there. Referencing any incompatible 64-bit DLL reference will raise the `0xc000007b` . I suggest that you rewrite `CMakeLists.txt` to accommodate 64-bit references for troubleshooting now. – Bilal Qandeel Jul 12 '21 at 23:45

1 Answers1

1

You might want to add the following two lines to ensure compiling your code as 32-bit:

set(CMAKE_C_FLAGS -m32)
set(CMAKE_CXX_FLAGS -m32)

The legends say that if you would use Eclipse IDE does that automatically where CLion does not necessarily do.

Bilal Qandeel
  • 727
  • 3
  • 6