编写DLL,需要申明一个结构和引用其他lib,如何写这个dll?

飞天凤凰601 2016-03-25 10:39:43
以下是
MyDll.h

#ifndef MyDll_H_
#define MyDll_H_
#ifdef MYLIBDLL
#define MYLIBDLL extern "C" _declspec(dllimport)
#else
#define MYLIBDLL extern "C" _declspec(dllexport)
#endif



typedef struct
{
BYTE* dataL;
BYTE* dataR;
BYTE* smallimg[9];
int width;
int height;
int bpp;
} FileImageDescripter;



MYLIBDLL FileImageDescripter* theNewImagesSourceFromFile2(Bitmap* img0);
MYLIBDLL BYTE* CompositeFinalImage2(FileImageDescripter* fid, int viewnum, int width, int height,float cot, float cover, float offset,int bmpwidth,int bmpheight,int style);
MYLIBDLL bool saveBmp(const char *bmpName,unsigned char* imgBuf,int width,int height,int biBitCount);
#endif


MyDll.cpp

#include "stdafx.h"
#include "MyDll.h"
#include <iostream>
using namespace std;

#include "FixGDI.h"
using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")

FileImageDescripter* theNewImagesSourceFromFile2(Bitmap* img0)
{
***
}
******


由于.h申明结构和。cpp引用#include "FixGDI.h"
using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")
造成不能编译,
不知道这种应该如何处理,才能制作成dll
各位C++高手帮忙一下。
.h哪个结构,用户调用dll时,需要用到
...全文
494 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
孤客天涯 2016-04-05
  • 打赏
  • 举报
回复
MYLIBDLL FileImageDescripter* theNewImagesSourceFromFile2(Bitmap* img0); 首先,你把Bitmap这个指针暴露出来,那也就是调用者需要有GDI+库,外面需要把GDI+相关的头文件加进来,如果你 不希望调用者引入GDI+,那你就要想办法把这函数改一下, 比如 MYLIBDLL FileImageDescripter* theNewImagesSourceFromFile2(CBitmap *img0);至少这个CBitmap类MFC直接可以用,你内部把 CBitmap转成Bitmap就可以了
飞天凤凰601 2016-03-25
  • 打赏
  • 举报
回复
"FixGDI.h" 说明得有 Gdiplus
飞天凤凰601 2016-03-25
  • 打赏
  • 举报
回复
引用 1 楼 iyomumx 的回复:
注意include顺序
什么意思?次序哪里不对了?
赵4老师 2016-03-25
  • 打赏
  • 举报
回复
小心字节对齐
iyomumx 2016-03-25
  • 打赏
  • 举报
回复
注意include顺序
飞天凤凰601 2016-03-25
  • 打赏
  • 举报
回复
知道的帮忙一下

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧