exokem
exokem
Explore posts from servers
CC#
Created by exokem on 3/19/2024 in #help
Creating a .NET language
I am interested in creating a language that, when compiled, is interoperable with C#. I understand the basics of lexing/parsing, but I don't know what would be necessary when compiling the syntax tree to IL in order for the language to be debuggable in something like visual studio or VSCode. I am comfortable approaching IL generation, but I don't know if I will need to generate a PDB or embed some other kind of debug labels in the IL or whatever else may be needed to allow debugging. I'm also not sure if there is anything else I should consider with this.
33 replies
CC#
Created by exokem on 7/25/2023 in #help
❔ DllImport From C Library
I have compiled a C library to a DLL and am trying to use some of the functions from this library in a C# project. C#:
const string nativeLibName = "FontCache";

[DllImport(nativeLibName, EntryPoint = "FC_CreateFont", CallingConvention = CallingConvention.Cdecl)]
static extern unsafe IntPtr INTERNAL_FC_CreateFont();

[DllImport(nativeLibName, EntryPoint = "FC_LoadFont")]
static extern unsafe int INTERNAL_FC_LoadFont(
IntPtr font,
IntPtr renderer,
byte* filename_ttf,
int pointSize,
SDL_Color color,
int style
);
const string nativeLibName = "FontCache";

[DllImport(nativeLibName, EntryPoint = "FC_CreateFont", CallingConvention = CallingConvention.Cdecl)]
static extern unsafe IntPtr INTERNAL_FC_CreateFont();

[DllImport(nativeLibName, EntryPoint = "FC_LoadFont")]
static extern unsafe int INTERNAL_FC_LoadFont(
IntPtr font,
IntPtr renderer,
byte* filename_ttf,
int pointSize,
SDL_Color color,
int style
);
C:
FC_Font* FC_CreateFont(void);

Uint8 FC_LoadFont(FC_Font* font, SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize, SDL_Color color, int style);
FC_Font* FC_CreateFont(void);

Uint8 FC_LoadFont(FC_Font* font, SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize, SDL_Color color, int style);
This exception occurs when either of the above functions are called:
An unhandled exception of type 'System.EntryPointNotFoundException' occurred in Xylem-Media.dll: 'Unable to find an entry point named 'FC_CreateFont' in DLL 'FontCache'.'
An unhandled exception of type 'System.EntryPointNotFoundException' occurred in Xylem-Media.dll: 'Unable to find an entry point named 'FC_CreateFont' in DLL 'FontCache'.'
I don't know if my DllImport signatures are correct, or if there is a problem with the way I have compiled the C library - I have tried using dumpbin and various DLL explorer tools to see which symbols are available but nothing ever appears under the module I am targeting.
14 replies
CC#
Created by exokem on 12/31/2022 in #help
Unresolved NuGet Dependency References
33 replies