954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Compiling flex file into dll.

Hi,

I've got a lexer created with flex (under cygwin). Normally I compile it to an .exe file.

For the newest project I need a lexer to use in a bigger C# program running on Windows XP. Of course I can execute a file using System.Diagnostics.Process. But it is not the best solution for me as I want that program to run on several machines.

How can I create a dll having the source code of the lexer?

I've already tried to run flex on my grammar and then compile the obtained c file with:

gcc -c lekser.c 
gcc -shared -o lekser.dll lekser.o

Dll file was created but it does not work. I've tried to access the library using the code:

[DllImport("lekser.dll")] public static extern int yylex();



but the DllNotFoundException occured. The file, for sure, is placed in the right directory and the C# code is correct (at least it works with another dll I've created to test this).

Thanks in advance...
Szpilona

Szpilona
Light Poster
46 posts since Mar 2008
Reputation Points: 28
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: