Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/148.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何创建dll接受参数_C++_C_Dll - Fatal编程技术网

C++ 如何创建dll接受参数

C++ 如何创建dll接受参数,c++,c,dll,C++,C,Dll,我必须创建dll,它将接受参数,然后用这些参数调用exe 一些代码如下所示 // exportimage.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #ifdef _MANAGED #pragma managed(push, off) #endif BOOL APIE

我必须创建dll,它将接受参数,然后用这些参数调用exe

一些代码如下所示

// exportimage.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #ifdef _MANAGED #pragma managed(push, off) #endif BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { int retCode = system("C:\\Inetpub\\wwwroot\\exporter\\res\\applet\\phantomjs.exe" " C:\\Inetpub\\wwwroot\\exporter\\res\\include\\highcharts-convert.js -infile" " C:\\Inetpub\\wwwroot\\exporter\\res\\graphs\\SVGData_137240462725.svg -outfile" " C:\\Inetpub\\wwwroot\\exporter\\res\\graphs\\Image_Export_137240462725.png" " -scale 2.5 -width 1088"); return TRUE; } #ifdef _MANAGED #pragma managed(pop) #endif //exportimage.cpp:定义DLL应用程序的入口点。 // #包括“stdafx.h” #包括 #包括 #ifdef_管理 #pragma管理(推、关) #恩迪夫 BOOL APICENT DllMain(模块HMODULE, 德沃德·乌尔打电话的理由, LPVOID lpReserved ) { int retCode=system(“C:\\Inetpub\\wwwroot\\exporter\\res\\applet\\phantomjs.exe” “C:\\Inetpub\\wwwroot\\exporter\\res\\include\\highcharts-convert.js-infle” “C:\\Inetpub\\wwwroot\\exporter\\res\\graphs\\SVGData\u 137240462725.svg-outfile” “C:\\Inetpub\\wwwroot\\exporter\\res\\graphs\\Image\u Export\u 137240462725.png” “-比例2.5-宽度1088”); 返回TRUE; } #ifdef_管理 #布拉格语管理(pop) #恩迪夫 现在在这里,我想获取以下参数
1) 导出器的路径
2) .svgfile的名称
3) .png文件的名称

我将通过设置此dll的操作通过html表单传递这些参数。因此,请告诉我这将需要进行哪些更改 对于上面的代码,当我将其用于给定的SVG文件时,它可以工作,但我的浏览器会挂起,所以也请告诉我这有什么问题,比如返回另一个这个等等


<>我用VC++创建了这个C++文件,对C++非常陌生。

< P>将实际代码放在导出函数中,而不是在DLLIN()中。您可以根据需要为导出的函数提供任何原型。

您必须指定入口点

__declspec(dllexport)
void foo(const char* path, const char* svgfile, const char* pngfile) {
  // do something
}

您不能在DllMain中添加这样的代码。

但是当我提交html表单时,foo将如何调用此函数。如果我删除DllMain或其他任何东西,在这种情况下,您不需要添加DllMain。DllMain是为特定部分保留的。所以你必须创建你的函数入口点。顺便问一下,你是什么意思
html表单
?您想在哪里使用此dll?我将通过提交Html表单来调用此dll。您是指CGI还是IIS ISAPI?谢谢您的回复,但您能否提供一些确切的代码,以便我提交表单和dll函数,其中包含执行exe的代码call@user571616恕我直言,StackOverflow不是一种代码编写服务。请试着自己做,如果你被卡住了,问一个具体的问题。