Tag: 移植

Windows等效于sys / mman.h

我在尝试在Win64上编译我的C代码时遇到了问题。 更具体地说,编译器找不到sys/mman.h头文件,我理解只能在Unix环境中找到它。 我已经知道这是内存分配的处理。 是否有一个等效的Windows我可以用来移植代码(第一次尝试)? 代码导致问题: /* Allocate memory required by processes */ buf = (int*) malloc (sizeof(int)); if (!buf) { perror(“Error”); free (buf); return -3; } /* Lock down pages mapped to processes */ puts(“Locking down processes.”); if(mlockall (MCL_CURRENT | MCL_FUTURE) < 0) { perror("mlockall"); free (buf); return -4; }

Matrix转换从Java移植到C,不兼容的类型问题

我必须在C中移植一些Java方法,有一个Java背景但我在C编程中是一个总的菜鸟 在java中 float[][] traspose(float Xy[][]) { float result[][]=new float[5000][3000]; for(int i = 0; i < m; i++) { for(int j = 0; j < n; j++) { result[i][j] = Xy[j][i]; } } return result; } 我的C移植尝试 float traspose(int m, int n, float Xy[m][n]) { int i,j; float result[5000][3000]; for(i = 0; i < m; i++) […]

将std :: map移植到C?

我正在将一些c ++代码移植到c。 什么是c中std :: map的可行等价物? 我知道c中没有等价物。 这就是我想要使用的: 在c ++中: std::map m_Textures; 在c: typedef struct { uint* intKey; sTexture* textureValue; } sTMTextureMap; 这是可行的还是我过分简化地图? 万一你没有达到目的,它是一个纹理贴图。