BUSBUILD link errors using CURL library

vanvanvan

Member
Hi I want to use external CURL functionality within JDE business function


  • I downloaded “C:\curl-win32”
  • Copied folder “C:\curl-win32\include\curl” to jde “C:\E920\DV920\include” folder. Also copied the contents of “C:\curl-win32\lib” to the “C:\E920\DV920\lib32” folder
  • Also the contents of “C:\curl-win32\bin” was copied across to “C:\E920\DV920\bin32”

I was able to compile some curl sample code (see below) but keep getting the following link errors which I can’t seem to get rid of….
Any help would be greatly appreciated.

B58WS002.c
Replacing B58WS002.obj
jdertdll.c
Creating library C:\E920\DV920\lib32\CCUSTOM.lib and object C:\E920\DV920\lib32\CCUSTOM.exp
sCCUSTOM.lib(B58WS002.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_strerror@4 referenced in function _CurlTest@12
sCCUSTOM.lib(B58WS002.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_init@0 referenced in function _CurlTest@12
sCCUSTOM.lib(B58WS002.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _CurlTest@12
sCCUSTOM.lib(B58WS002.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_perform@4 referenced in function _CurlTest@12
sCCUSTOM.lib(B58WS002.obj) : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup@4 referenced in function _CurlTest@12
C:\E920\DV920\bin32\CCUSTOM.dll : warning LNK4088: image being generated due to /FORCE option; image may not run

Adjusting DLL load addresses . . .
************Build Finished************

CCUSTOM.dll - 5 error(s), 1 warning(s): Build forced to complete with errors.
---------------------------------------------------------------------------
#include <jde.h>
#include <b58ws002.h>

#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
#define b58ws002_c


JDEBFRTN(ID) JDEBFWINAPI CurlTest(LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD9800100 lpDS)

{
/************************************************************************
* Variable declarations
************************************************************************/
/************************************************************************
* Variable declarations
************************************************************************/
CURL *curl;
CURLcode res;

static const char *postthis = "moo mooo moo moo";

/************************************************************************
* Declare structures
************************************************************************/

/************************************************************************
* Declare pointers
************************************************************************/

/************************************************************************
* Check for NULL pointers
************************************************************************/
if ((lpBhvrCom == (LPBHVRCOM)NULL) ||
(lpVoid == (LPVOID)NULL) ||
(lpDS == (LPDSD9800100)NULL))
{
jdeErrorSet(lpBhvrCom, lpVoid, (ID)0, _J("4363"), (LPVOID)NULL);
return ER_ERROR;
}

/************************************************************************
* Set pointers
************************************************************************/

/************************************************************************
* Main Processing
************************************************************************/


curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis);

/* if we don't provide POSTFIELDSIZE, libcurl will strlen() by
itself */
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(postthis));

/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));

/* always cleanup */
curl_easy_cleanup(curl);
}
return (ER_SUCCESS);
}
---------------------------------------------------------------------------
 
If you are trying to do this in a JDE BSFN, you will probably want to you dynamic linking instead of static linking.
 
Back
Top